From 97246845daf8b16e232582c38331903a353cedd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Fri, 27 Feb 2026 10:45:08 +0100 Subject: [PATCH] useContext -> useContextFromLayer --- packages/effect-fc/src/Component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/effect-fc/src/Component.ts b/packages/effect-fc/src/Component.ts index 28f0091..0398dac 100644 --- a/packages/effect-fc/src/Component.ts +++ b/packages/effect-fc/src/Component.ts @@ -1033,7 +1033,7 @@ export declare namespace useContext { * ```tsx * const MyLayer = Layer.succeed(MyService, new MyServiceImpl()) * const MyComponent = Component.make(function*() { - * const context = yield* Component.useContext(MyLayer) + * const context = yield* Component.useContextFromLayer(MyLayer) * const Sub = yield* SubComponent.use.pipe( * Effect.provide(context) * ) @@ -1045,7 +1045,7 @@ export declare namespace useContext { * @example With memoized layer * ```tsx * const MyComponent = Component.make(function*(props: { id: string })) { - * const context = yield* Component.useContext( + * const context = yield* Component.useContextFromLayer( * React.useMemo(() => Layer.succeed(MyService, new MyServiceImpl(props.id)), [props.id]) * ) * const Sub = yield* SubComponent.use.pipe( @@ -1060,7 +1060,7 @@ export declare namespace useContext { * ```tsx * const MyAsyncLayer = Layer.effect(MyService, someAsyncEffect) * const MyComponent = Component.make(function*() { - * const context = yield* Component.useContext(MyAsyncLayer) + * const context = yield* Component.useContextFromLayer(MyAsyncLayer) * const Sub = yield* SubComponent.use.pipe( * Effect.provide(context) * ) @@ -1070,7 +1070,7 @@ export declare namespace useContext { * Async.async // Required to handle async layer effects * ) */ -export const useContext = ( +export const useContextFromLayer = ( layer: Layer.Layer, options?: useContext.Options, ): Effect.Effect, E, RIn | Scope.Scope> => useOnChange(() => Effect.context().pipe(