Skip to content

coma/react-teleport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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