Utility hook to store values in browser’s session storage.

Example

const [needConfirm, setNeedConfirm] = useLocalStorage("CONFIRM_ORDER", true);

return (
  <>
    {/* ... */}
    <label>
      Confirm Order
      <input
        type="checkbox"
        checked={needConfirm}
        onChange={() => {
          setNeedConfirm(!needConfirm);
        }}
      />
    </label>
  </>
);