(atom: Atom<T> | Atom<Promise<T>>)
| 236 | const NullAtom = atom(null); |
| 237 | |
| 238 | function useAtomValueSafe<T>(atom: Atom<T> | Atom<Promise<T>>): T { |
| 239 | if (atom == null) { |
| 240 | return useAtomValue(NullAtom) as T; |
| 241 | } |
| 242 | return useAtomValue(atom); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Simple wrapper function that lazily evaluates the provided function and caches its result for future calls. |
no outgoing calls
no test coverage detected