1.0.0 • Published 9 years ago

react-summoner v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

React Summoner

Build Status Test Coverage Dependency Status devDependency Status

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="{&quot;name&quot;:&quot;value&quot;}" />

Isomorphic-friendly

Will not run on the server, while it will still expose the register function.

License

See the License file.