3.0.3 • Published 6 years ago
dot-store-react v3.0.3
dot-store-react
React integration for dot-store.
Install
npm install --save dot-store-react
Provider
Add StoreProvider
to your component tree:
import Store from "dot-store"
import { StoreProvider } from "dot-store-react"
export default class Layout extends React.Component {
constructor(props) {
super(props)
this.store = new Store({ counter: 0 })
}
render() {
return (
<StoreProvider store={this.store}>
{this.props.children}
</StoreProvider>
)
}
)
Consumer
import { withStore } from "dot-store-react"
class Page extends React.Component {
shouldComponentUpdate({ detectChanges }) {
return detectChanges("counter")
}
render() {
return this.props.state.counter
}
}
export default withStore(Page)
Props
Prop | Type | Description |
---|---|---|
changes | Array[String] | Changed dot-props |
detectChanges | Function<...String> | Change match helper |
state | Object | The store.state value at render time |
store | DotStore | The store |
Tip: The detectChange
helper can match the prop and its children by adding .*
to the end of the match string.
3.0.3
6 years ago
3.0.2
6 years ago
3.0.0
6 years ago
2.6.25
6 years ago
2.6.14
6 years ago
2.6.13
6 years ago
2.6.3
6 years ago
2.4.9
6 years ago
2.4.8
6 years ago
2.4.3
6 years ago
2.4.2
6 years ago
2.4.1
6 years ago
2.4.0
6 years ago
2.3.0
6 years ago
2.1.0
6 years ago
2.0.0
6 years ago
1.0.0
6 years ago
0.6.0
6 years ago
0.5.5
6 years ago
0.5.4
6 years ago
0.5.3
6 years ago
0.5.2
6 years ago
0.5.1
6 years ago
0.5.0
6 years ago
0.4.0
6 years ago
0.3.0
6 years ago
0.2.0
6 years ago
0.1.7
6 years ago
0.1.5
6 years ago
0.1.4
6 years ago
0.1.3
6 years ago
0.1.2
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
0.0.1
6 years ago