@flexbase/store-react
v3.0.0
Published
React extensions for @flexbase/store
Downloads
86
Readme
store-react
Installation
npm install @flexbase/store-react
or
yarn add @flexbase/store-react
Usage
useStore
integrates useState with flexbase store
import { useStore } from '@flexbase/store-react';
export const component = () => {
const [value, setValue] = useStore(store);
return (
<div>
<p>You clicked {value} times</p>
<button onClick={() => setValue(count + 1)}>Click me</button>
</div>
);
};
useStoreLayout
integrates useLayoutEffect with flexbase store
import { useStoreLayout } from '@flexbase/store-react';
export const component = () => {
const [value, setValue] = useStoreLayout(store);
return (
<div>
<p>You clicked {value} times</p>
<button onClick={() => setValue(count + 1)}>Click me</button>
</div>
);
};