Router setup
Some checks failed
Lint / lint (push) Failing after 9s

This commit is contained in:
Julien Valverdé
2025-01-11 16:36:06 +01:00
parent 5f455295ad
commit 6373919fc4
16 changed files with 222 additions and 165 deletions

View File

@@ -0,0 +1,22 @@
import { Reffuse } from "@/reffuse"
import { createRootRoute, Link, Outlet } from "@tanstack/react-router"
import { TanStackRouterDevtools } from "@tanstack/router-devtools"
export const Route = createRootRoute({
component: Root
})
function Root() {
return (
<Reffuse.Provider>
<div className="container mx-auto flex-row justify-center items-center gap-2 mb-4">
<Link to="/">Index</Link>
<Link to="/count">Count</Link>
</div>
<Outlet />
<TanStackRouterDevtools />
</Reffuse.Provider>
)
}

View File

@@ -0,0 +1,27 @@
import { Reffuse } from "@/reffuse"
import { createFileRoute } from "@tanstack/react-router"
import { Ref } from "effect"
export const Route = createFileRoute("/count")({
component: Count
})
function Count() {
const runtime = Reffuse.useRuntime()
const countRef = Reffuse.useRef(0)
const [count] = Reffuse.useRefState(countRef)
return (
<div className="container mx-auto">
{/* <button onClick={() => setCount((count) => count + 1)}> */}
<button onClick={() => Ref.update(countRef, count => count + 1).pipe(runtime.runSync)}>
count is {count}
</button>
</div>
)
}

View File

@@ -0,0 +1,10 @@
import { createFileRoute } from "@tanstack/react-router"
export const Route = createFileRoute("/")({
component: Index
})
function Index() {
return <></>
}