effect-cycle-router
v0.1.0
Published
Router driver for effect-cycle
Readme
effect-cycle-router
Router driver for effect-cycle. Wraps the History API as a RouterSource (location stream) and a RouterSink (navigate / push / replace).
Install
pnpm add effect-cycle-router effect-cycle-core effectUsage
import { Effect, Stream } from "effect"
import { RouterSink, RouterSource, matchPath } from "effect-cycle-router"
const app = Effect.gen(function* () {
const router = yield* RouterSource
const nav = yield* RouterSink
yield* Stream.runForEach(router.location$, (loc) =>
Effect.log(`nav: ${loc.path}`),
)
yield* nav.push("/about")
})Use matchPath(pattern, path) for pattern-based route matching with typed params.
See the main README and DESIGN.md for the full design.
License
MIT © Josh Burgess
