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>
            );
        }
    });

    Install

    npm i react-teleport

    DownloadsWeekly Downloads

    0

    Version

    0.1.3

    License

    MIT

    Last publish

    Collaborators

    • coma