| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2018-10-06 | 1.0 kB | |
| v2.0.2 source code.tar.gz | 2018-10-06 | 103.5 kB | |
| v2.0.2 source code.zip | 2018-10-06 | 107.5 kB | |
| Totals: 3 Items | 212.1 kB | 2 | |
Changelog
🚀 Features
- feat: add
Providerbecause of suspense features - feat: add
subscribemethod
⚠️ Breaking Changes
Now you need to wrap your entire application using reworm provider!
:::jsx
import React from 'react'
import { Provider, create } from 'reworm'
const { get } = create({ name: 'John' })
const App = () => (
<Provider>
<div>{get(s => s.name)}</div>
</Provider>
)
Listening state changes
If you want to listen changes on your state you can use subscribe():
:::jsx
import React from 'react'
import { Provider, create } from 'reworm'
const user = create()
class App extends Component {
state = {
name: 'John'
}
componentDidMount() {
user.subscribe(name => this.setState({ name }))
user.set('Michael')
}
render() {
return <div>Hello {this.state.name}</div>
}
}