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

atomRegistry.ts

14 lines497 Bytes

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