useResetAtom does not work on atomWithDefault
See original GitHub issueatomWithDefault
can be reset by sending the REFRESH
symbol.
atomWithReset
can be reset by sending the RESET
symbol or with useResetAtom
.
useResetAtom
does not work on atomWithDefault
.
Should we get rid of the REFRESH
symbol, and instead use the RESET
symbol everywhere including atomWithDefault
? Then useResetAtom
would work on atomWithDefault
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
atomWithDefault - Jotai
Usage. This is a function to create a resettable primitive atom. Its default value can be specified with a read function instead of...
Read more >jotai/atom-with-default.mdx at main - GitHub
This is a function to create a resettable primitive atom. Its default value can ... import { useAtom } from 'jotai' import {...
Read more >@fattafatta/rescript-jotai - npm
A hook that returns only the update function of an atom. Can be used to access writeOnly atoms. let atom = Jotai.Atom.
Read more >docs/api/utils.mdx | jotai@v1.5.0 - Deno
utils/atom-with-reducer.mdx) This is a function to create an atom with an embeded reducer function to update the value.10. [atomWithDefault](.
Read more >jotai - UNPKG
7, throw new Error('Dynamic require of "' + x + '" is not supported');. 8, };. 9, const WRITE_ATOM = "w"; ... 34,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
API-wise, it’s possible. However, implementation-wise, atomWithReset is only one atom internally, whereas atomWithDefault comes with two atoms. In other words, atomWtihReset can be more performance tuned.
Thanks for the comment. Just opened a PR #552.