You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

react-minimalist-portal

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-minimalist-portal

A minimalist portal for react

2.3.1
latest
Source
npm
Version published
Weekly downloads
6.9K
-23.98%
Maintainers
1
Weekly downloads
 
Created
Source

react-minimalist-portal

A minimalist portal for react. Create a new React tree in document.body to create modal etc .. This package is compatible with react 15 and 16.

npm version npm Build Status Coverage Status

Usage

import React from 'react';
import Portal from 'react-minimalist-portal';

export default class App extends React.Component {
  render() {
    return (
      <Portal>
        <p>I am in document body.</p>
      </Portal>
    );
  }
}

// If you want to render the portal inside your own container
const container = document.getElementById('my-custom-container-id');

export default class App extends React.Component {
  render() {
    return (
      <Portal container={container}>
        <p>I am in my-custom-container-id.</p>
      </Portal>
    );
  }
}

Props

  • container - optional - You can specify a container prop which should be of Element type. The portal will be rendered inside that element. The default behavior will create a div node and render it at the at the end of document.body.

Keywords

react

FAQs

Package last updated on 24 May 2018

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