Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

atomRegistry.tsx

14 lines517 Bytes

1import { RegistryContext } from "@effect/atom-react";
2import { AtomRegistry } from "effect/unstable/reactivity";
3import type { ReactNode } from "react";
4​
5export let appAtomRegistry = AtomRegistry.make();
6​
7export function AppAtomRegistryProvider({ children }: { readonly children: ReactNode }) {
8 return <RegistryContext.Provider value={appAtomRegistry}>{children}</RegistryContext.Provider>;
9}
10​
11export function resetAppAtomRegistryForTests() {
12 appAtomRegistry.dispose();
13 appAtomRegistry = AtomRegistry.make();