react-portal-lite

Transport React elements to document.body

Usage no npm install needed!

<script type="module">
  import reactPortalLite from 'https://cdn.skypack.dev/react-portal-lite';
</script>

README

React-Portal (lite)

Travis Codecov license semantic-release

A lightweight component that transports HTML elements to the end of document.body.

Installation

$ npm install --save react-portal-lite

Basic Usage

<Transport isOpen>
  <h1>Hello World</h1>
</Transport>

// The H1 element will be appended to the end of document.body

API

Property Description
isOpen Accepts a boolean. If true, the element will be removed from the normal HTML flow and appended to the end of document.body. If false, nothing will render.
children A single React element that will be appended to the end of document.body.