0.1.92 • Published 6 years ago

baobab-connect v0.1.92

Weekly downloads
32
License
MIT
Repository
github
Last release
6 years ago

Baobab-connect

Baobab and React (Preact / InfernoJS) integration.

Installation

You can install baobab-connect through npm:

npm install baobab-connect

Or through yarn:

yarn add baobab-connect

Peer dependencies

This library necessitate that you install baobab >= 2.0.0.

Documentation

This library contains two functions – root and connect.

root

The root method aims at passing a baobab tree through context so that other components (branches/containers/controllers) may use it. Typically, your app's top-level component will probably contains a root defintion.

import Baobab from 'baobab'
import {root} from 'baobab-connect'
const tree = new Baobab({foo: {bar: 'baz'}})
root(tree) // that's it!

connect

The connect bound to cursors, get their data from the tree given by the root.

Here is an example of displaying foo.bar value of our tree created at previous step:

import connect from 'baobab-connect'

@connect({
  bar: 'foo.bar'
})
const BarComponent = ({bar}) => <span>{bar}</span>
export default BarComponent
0.1.92

6 years ago

0.1.91

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago