Asosiy tarkibga o'tish

createStoreConsumer

createStoreConsumer(store)

Creates store-based react component which is watching for changes in the store. Based on Render Props technique.

Arguments

  1. store (Store)

Returns

(React.Component)

Example

import {createStore} from 'effector'
import {createStoreConsumer} from 'effector-react'

const $firstName = createStore('Alan')

const FirstName = createStoreConsumer($firstName)

const App = () => <FirstName>{name => <h1>{name}</h1>}</FirstName>

Try it