Pay attention
This documentation is for the as yet unreleased version of effector Spacewatch 23.0.

createStoreConsumer

Deprecated

since effector-react 23.0.0.

Consider using hooks api in modern projects.

createStoreConsumer(store)

Creates a 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

Contributors