Similar to useState
but with some lightweight behind-the-scenes
writing to localStorage; also subscribes to changes in localStorage
to allow for cross-tab changes to sync automatically.
The first argument is the name of the local storage property/key you want to control with this hook. The second argument,
options
, really just has one available directive: bool
. Setting bool
to true
has the effect of evaluating the data