0.2.1 • Published 5 years ago

jabr-react v0.2.1

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

Jabr-React

Basics

At the top level of your React app simply wrap it in the Provider class. Not providing a store prop will make it automatically initiate an empty store. Additionally you can instead provide an object to initialize the store's contents.

const {Provider} = require('jabr-react')
// ... in your rendering code
<Provider store={{loggedIn: false}}>
    //React Components
</Provider>

Next in your descendant children simply import the connect function, then provide it first a function to retrieve the data from the store, then your component you would like to connect, then inside your component retrieve the store data from this.props.store.

const React = require('react')
const {connect} = require('jabr-react')

class MyClass extends React.Component {
    render() {
        return <p>{this.props.store.loggedIn.toString()} // renders <p>false</p>
    }
}

module.exports = connect(store => ({loggedIn: store.loggedIn}), MyClass)
0.2.1

5 years ago

0.2.0

5 years ago

0.1.21

6 years ago

0.1.2

6 years ago

0.1.19

6 years ago

0.1.11

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago