Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/react-portal

Package Overview
Dependencies
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-portal

Portal component

  • 4.6.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
539
decreased by-5.77%
Maintainers
1
Weekly downloads
 
Created
Source

Portal 入口

Portals 是 react 16 提供的官方解决方案,使得组件可以脱离父组件层级挂载在 DOM 树的任何位置,我们利用这个方法,可将模态对话框生成到根节点的外面。

import { Portal } from 'uiw';
// or
import Portal from '@uiw/react-portal';

基本使用

import { Portal } from 'uiw';

const Demo = () => {
  return (
    <Portal className="name" visible={true}>
      容器内显示内容
    </Portal>
  )
}

Props

参数说明类型默认值
className指定样式名string-
visible当值为 true 的时候才会创建 createPortal,可避免初始化创建多余的 dom 节点挂载boolean-
container指定容器节点生成,服务端渲染默认为 nullanydocument.body
onChildrenMount渲染后的回调函数() => void-

Keywords

FAQs

Package last updated on 19 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc