@@ -612,12 +612,12 @@ export const withOptions: {
|
||||
*
|
||||
* // Route definition
|
||||
* export const Route = createFileRoute("/")({
|
||||
* component: Component.withRuntime(HomePage, runtime.context)
|
||||
* component: Component.withContext(HomePage, runtime.context)
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
export const withRuntime: {
|
||||
export const withContext: {
|
||||
<P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
|
||||
context: React.Context<Context.Context<R>>,
|
||||
): (self: Component<P, A, E, Scope.Scope | NoInfer<R>, F>) => F
|
||||
@@ -628,9 +628,9 @@ export const withRuntime: {
|
||||
} = Function.dual(2, <P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
|
||||
self: Component<P, A, E, R, F>,
|
||||
context: React.Context<Context.Context<R>>,
|
||||
) => function WithRuntime(props: P) {
|
||||
) => function WithContext(props: P) {
|
||||
return React.createElement(
|
||||
Effect.runSyncWith(React.useContext(context))(self.use) as React.FC<P>,
|
||||
Effect.runSyncWith(React.useContext(context))(self.use),
|
||||
props,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user