Last active
December 8, 2021 01:06
-
-
Save notsidney/d0caa489ee77da35d9af19ec085ac4d2 to your computer and use it in GitHub Desktop.
Jotai atomWithHash example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const modalOpenAtom = atomWithHash("modalOpen", false, { | |
replaceState: true, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { atomWithHash } from "jotai/utils"; | |
export const modalOpenAtom = atomWithHash("modalOpen", false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cloudLogFilters = { | |
"type": "build", | |
"timeRange": { "type": "days", "value": 7 }, | |
"buildLogExpanded": 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useAtom } from "jotai"; | |
import { modalOpenAtom } from "./atoms"; | |
function ExampleModal() { | |
const [open, setOpen] = useAtom(modalOpenAtom); | |
return ( | |
<Dialog | |
open={open} | |
onClose={() => setOpen(false)} | |
... | |
/> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment