createComponent(store, render)
Creates store-based React component.
Arguments
store
(Store)render
(Function)
Returns
(React.Component
)
Example
import {createStore, createEvent} from 'effector'
import {createComponent} from 'effector-react'
const counter = createStore(0)
const incr = createEvent('increment')
counter.on(incr, n => n + 1)
const MyCounter = createComponent(counter, (props, state) => (
<div>
Counter: {state}
<button onClick={incr}>increment</button>
</div>
))