package
Simple, unopinionated, React portal that renders it's subtree into a desired container.
npm install react-travelGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 6 packages.
198.8 kB
Includes dependencies.
Your subtree should be able to travel into another top-level tree.
<Travel
onMount={node => {
return(
$(node).dialog({
autoOpen: false,
close: () => {
this.setState({dialogOpen: false})
}
}).data('ui-dialog')
)
}}
onUpdate={dialog => {
if(dialogOpen) {
dialog.open()
} else {
dialog.close()
}
}}
>
<div>
Even works with third party dialogs!
</div>
</Travel>to: PropTypes.anyWhat node the portal is rendered to, defaults to document.body.
tag: PropTypes.stringWhat tag to use for the portal, defaults to div.
id: PropTypes.stringReact id prop.
className: PropTypes.anyReact className prop.
style: PropTypes.objectReact style prop. Accepts an object of styles that are applied to the portal. Note that values require their respective unit applied i.e style={{padding: '12px'}}.
children: PropTypes.elementAccepts a single React element or component.
onMount: PropTypes.funconUpdate: PropTypes.funconUnmount: PropTypes.funcAll tie into React's life cycle methods. Returns portal node with any work done to it.