Returns a tuple where the first element is the value of state and the second element is a setter function that will update the value of the given state when called.
This hook will implicitly subscribe the component to the given state.
atomor a writeable
selector. Writeable selectors are selectors that have both a
setin their definition while read-only selectors only have a
This API is similar to the React (
useState())[https://reactjs.org/docs/hooks-reference.html#usestate] hook except it takes a Recoil state instead of a default value as an argument. It returns a tuple of the current value of the state and a setter function. The setter function may either take a new value as an argument or an updater function which receives the previous value as a parameter.
This is the recommended hook to use when a component intends to read and write state.
Using this hook in a React component will subscribe the component to re-render when the state is updated. This hook may throw if the state has an error or is pending asynchronous resolution. Please see this guide.