@@ -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>
|
||||||
|
|||||||
@@ -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>>
|
||||||
Reference in New Issue
Block a user