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 15 additions and 6 deletions
Showing only changes of commit 64c07a62e6 - Show all commits

View File

@@ -1,3 +1,5 @@
import { Console } from "effect"
import { useState } from "react"
import "./App.css" import "./App.css"
import reactLogo from "./assets/react.svg" import reactLogo from "./assets/react.svg"
import { Reffuse } from "./Reffuse" import { Reffuse } from "./Reffuse"
@@ -6,7 +8,11 @@ import viteLogo from "/vite.svg"
export function App() { export function App() {
const [count, setCount] = Reffuse.useRefState(Reffuse.useRef(0)) Reffuse.runSync(Console.log("test"))
// const [count, setCount] = Reffuse.useRefState(Reffuse.useRef(0))
const [count, setCount] = useState(0)
return <> return <>
<div> <div>

View File

@@ -7,12 +7,15 @@ export class Reffuse<R, ER> {
constructor( constructor(
private readonly runtime: ManagedRuntime.ManagedRuntime<R, ER> private readonly runtime: ManagedRuntime.ManagedRuntime<R, ER>
) { ) {
this.Context = React.createContext(runtime) const Context = React.createContext(runtime)
this.Context = Context
this.Provider = (props: { readonly children?: React.ReactNode }) => this.Context({ this.Provider = (props: { readonly children?: React.ReactNode }) => (
...props, <Context
value: this.runtime, {...props}
}) value={runtime}
/>
)
} }
readonly Context: React.Context<ManagedRuntime.ManagedRuntime<R, ER>> readonly Context: React.Context<ManagedRuntime.ManagedRuntime<R, ER>>