0.1.0 #1

Merged
Thilawyn merged 87 commits from next into master 2025-01-18 00:54:42 +01:00
2 changed files with 37 additions and 0 deletions
Showing only changes of commit 9f08894b61 - Show all commits

View File

@@ -0,0 +1,32 @@
import { Context, Layer } from "effect"
import React from "react"
export interface ReffuseContext<R> {
readonly Context: React.Context<Context.Context<R>>
readonly Provider: ReffuseContextReactProvider<R>
}
export type ReffuseContextReactProvider<R> = React.FC<{
readonly layer: Layer.Layer<R, unknown>
readonly children?: React.ReactNode
}>
export type R<T> = T extends ReffuseContext<infer R> ? R : never
export function make<R>(): ReffuseContext<R> {
const Context = React.createContext<Context.Context<R>>(null!)
return {
Context,
Provider: function ReffuseContextReactProvider(props) {
return (
<Context
{...props}
/>
)
},
}
}

View File

@@ -0,0 +1,5 @@
import type { Runtime } from "effect"
import React from "react"
export interface ReffuseRuntime<R> extends React.Context<Runtime.Runtime<R>> {}