30
packages/example/src/routes/teardown.tsx
Normal file
30
packages/example/src/routes/teardown.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Reffuse } from "@/reffuse"
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
import { DateTime, Effect, Ref, SubscriptionRef } from "effect"
|
||||
import { useMemo } from "react"
|
||||
|
||||
|
||||
export const Route = createFileRoute("/teardown")({
|
||||
component: Teardown
|
||||
})
|
||||
|
||||
function Teardown() {
|
||||
|
||||
const runtime = Reffuse.useRuntime()
|
||||
|
||||
const timeRef = useMemo(() => DateTime.now.pipe(
|
||||
Effect.flatMap(SubscriptionRef.make),
|
||||
runtime.runSync,
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
), [])
|
||||
|
||||
Reffuse.useFork(DateTime.now.pipe(
|
||||
Effect.flatMap(Ref.set(timeRef))
|
||||
))
|
||||
|
||||
const [time] = Reffuse.useRef(timeRef)
|
||||
|
||||
|
||||
return <></>
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user