Spaces:
Runtime error
Runtime error
File size: 588 Bytes
7362797 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the Chameleon License found in the
* LICENSE file in the root directory of this source tree.
*/
import { useEffect, useState } from "react";
export function useAdvancedMode(): [boolean, (on: boolean) => void] {
const [advancedMode, setAdvancedMode] = useState(
(localStorage.getItem("advancedMode") || "") === "true",
);
useEffect(() => {
localStorage.setItem("advancedMode", advancedMode ? "true" : "false");
}, [advancedMode]);
return [advancedMode, setAdvancedMode];
}
|