react-teleport

0.1.3 • Public • Published

react-teleport

Build Status Dependency Status NPM version

A neat way of handling views on other components

Usage

Just mount a destination on one of your components:

var React       = require('react'),
    Destination = require('react-teleport').Destination;
 
module.exports = module.exports = React.createClass({
    render: function () {
 
        return (
            <div>
                <Destination name="header"/>
            </div>
        );
    }
});

and then send an element from another:

var React  = require('react'),
    Portal = require('react-teleport').Portal;
 
module.exports = module.exports = React.createClass({
    render: function () {
 
        return (
            <div>
                <Portal destination="header">
                    <nav>
                        <a href="#">some</a>
                        <a href="#">breadcrumbs</a>
                        <a href="#">on the header!</a>
                    </nav>
                </Portal>
            </div>
        );
    }
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.3
    1
    • latest

Version History

Package Sidebar

Install

npm i react-teleport

Weekly Downloads

1

Version

0.1.3

License

MIT

Last publish

Collaborators

  • coma