# `createStateContext` Factory for react context hooks that will behave just like [React's `useState`](https://reactjs.org/docs/hooks-reference.html#usestate) except the state will be shared among all components in the provider. This allows you to have a shared state that any component can update easily. ## Usage An example with a shared text between two input fields. ```jsx import { createStateContext } from 'react-use'; const [useSharedText, SharedTextProvider] = createStateContext(''); const ComponentA = () => { const [text, setText] = useSharedText(); return (
Component A:
setText(ev.target.value)} />
Component B:
setText(ev.target.value)} />
Those two fields share the same value.