@@ -1,3 +1,4 @@
|
||||
import { Ref } from "effect"
|
||||
import "./App.css"
|
||||
import reactLogo from "./assets/react.svg"
|
||||
import { Reffuse } from "./Reffuse"
|
||||
@@ -6,7 +7,10 @@ import viteLogo from "/vite.svg"
|
||||
|
||||
export function App() {
|
||||
|
||||
const [count, setCount] = Reffuse.useRefState(Reffuse.useRef(0))
|
||||
const runtime = Reffuse.useRuntime()
|
||||
|
||||
const countRef = Reffuse.useRef(0)
|
||||
const [count] = Reffuse.useRefState(countRef)
|
||||
|
||||
|
||||
return <>
|
||||
@@ -20,7 +24,8 @@ export function App() {
|
||||
</div>
|
||||
<h1>Vite + React</h1>
|
||||
<div className="card">
|
||||
<button onClick={() => setCount((count) => count + 1)}>
|
||||
{/* <button onClick={() => setCount((count) => count + 1)}> */}
|
||||
<button onClick={() => Ref.update(countRef, count => count + 1).pipe(runtime.runSync)}>
|
||||
count is {count}
|
||||
</button>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user