1.0.0 • Published 8 years ago
react-summoner v1.0.0
React Summoner
Instantiate React Components in the wild. Specially useful for plural ecosystems.
Get Started
npm install react-summoner
API
register(name, component)
Register a component to be summoned anytime.
name
: Component name. (String)component
: Valid React Component. (React Component)
react-summon (component-name, component-props)
Instantiates a previously registered React Component.
component-name
: Component name. (String)component-props
: Encoded JSON properties object. (String)
Usage
// In 0.1.0 (Deprecated)
var register = require('react-summoner')()
// In 1.0.0
var register = require('react-summoner').register
// or
import { register } from 'react-summoner'
var MyComponent = React.createClass({ /* ... */ })
register("MyComponent", MyComponent)
<react-summon component-name="MyComponent" component-props="{"name":"value"}" />
Isomorphic-friendly
Will not run on the server, while it will still expose the register
function.
License
See the License file.