This package has been deprecated

Author message:

This package has moved to @burning-duck/rehace

rehace

0.2.0 • Public • Published

rehace

React-Habitat-Cerebral: Components for HTML

Connects React-Habitat components to a single Cerebral controller.

Basic Usage

You can find a simple demo using the Counter example from the cerebral sitein the /demo folder of this repo. See the working example at https://burning-duck.github.io/rehace/.

The main difference is, that you don't render your root Components into the page. Just register them in an React-Habitat container for later use.

ReHaCe wraps each registered component in an Cerebral container using controller instance you passed in. This allows each component to connect to the same state.

index.js

import { Rehace } from 'rehace'
 
// This is the Cerebral controller
import controller from './controller'
 
// Components to register
import Counter from './components/Counter'
import IncreaseButton from './components/IncreaseButton'
import DecreaseButton from './components/DecreaseButton'
 
export const app =  Rehace(Module{
  controller: controller,
  components: {
    'Counter': Counter,
    'IncreaseButton': IncreaseButton,
    'DecreaseButton': DecreaseButton
  }
})

In your HTML file you can use React-Habitat syntax to use the components.

index.html

<p>
    The current count is <strong><span data-component="Counter"></span></strong>.<br/>
    You can increase the counter: <span data-component="IncreaseButton"></span>.<br/>
    You can descrease the counter: <span data-component="DecreaseButton"></span>.<br/>
</p>

Read more

Package Sidebar

Install

npm i rehace

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • burning-duck