Creating the Registry Provider

Avatar of Hemanta SundarayHemanta Sundaray

In providers/atom-registry-provider.tsx, add the following code:

providers/atom-registry-provider.tsx
"use client";
import { ReactNode } from "react";
import { RegistryProvider } from "@effect-atom/atom-react";
export function AtomRegistryProvider({ children }: { children: ReactNode }) {
return <RegistryProvider>{children}</RegistryProvider>;
}

We import RegistryProvider and wrap the children prop with it. When RegistryProvider renders, it creates a Registry instance and makes it available to the entire component tree through React Context.

We also explicitly mark this file with "use client" because the Registry relies on React Context and hooks to manage state updates, which are client-side features.

Sign in to save progress

Stay in the loop

Get notified when new chapters are added and when this course is complete.