Utility hook to store values in browser’s session storage.
const [needConfirm, setNeedConfirm] = useLocalStorage("CONFIRM_ORDER", true); return ( <> {/* ... */} <label> Confirm Order <input type="checkbox" checked={needConfirm} onChange={() => { setNeedConfirm(!needConfirm); }} /> </label> </> );