All Projects → zoontek → react-chicane

zoontek / react-chicane

Licence: MIT license
A simple and safe router for React and TypeScript.

Programming Languages

typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-chicane

Mu
A tweet-sized PHP micro-router
Stars: ✭ 229 (+19.9%)
Mutual labels:  router
FGRoute
Get your device ip address, router ip or wifi ssid
Stars: ✭ 128 (-32.98%)
Mutual labels:  router
RoundedLayout
This is a library that has a rounded cut of View, support whether the specified corners are cropped and add a custom Border, and add a shadow support from API 9, which is based on FrameLayout, that is, His Child can be any View, the current library or preview version, if you encounter problems in the process can submit issue or pr.
Stars: ✭ 24 (-87.43%)
Mutual labels:  router
Router
Router implementation for fasthttp
Stars: ✭ 234 (+22.51%)
Mutual labels:  router
rux
⚡ Rux is an simple and fast web framework. support route group, param route binding, middleware, compatible http.Handler interface. 简单且快速的 Go api/web 框架,支持路由分组,路由参数绑定,中间件,兼容 http.Handler 接口
Stars: ✭ 81 (-57.59%)
Mutual labels:  router
svelte-starter-kit
Svelte starter kit — router, state management and testing included.
Stars: ✭ 16 (-91.62%)
Mutual labels:  router
Esp32 nat router
A simple NAT Router for the ESP32
Stars: ✭ 226 (+18.32%)
Mutual labels:  router
fast-route
PSR-15 middleware to use FastRoute
Stars: ✭ 91 (-52.36%)
Mutual labels:  router
svelte-micro
Light & reactive one-component router for Svelte
Stars: ✭ 81 (-57.59%)
Mutual labels:  router
es6-router
🌐 Simple client side router built in ES6
Stars: ✭ 16 (-91.62%)
Mutual labels:  router
Swiftuirouter
Routing in SwiftUI
Stars: ✭ 242 (+26.7%)
Mutual labels:  router
Golf
⛳️ The Golf web framework
Stars: ✭ 248 (+29.84%)
Mutual labels:  router
tulingx
TULINGX(图灵)VPN下载页 翻墙 代理 科学上网 外网 加速器 梯子 路由
Stars: ✭ 59 (-69.11%)
Mutual labels:  router
Klein.php
A fast & flexible router
Stars: ✭ 2,622 (+1272.77%)
Mutual labels:  router
easytcp
✨ 🚀 EasyTCP is a light-weight TCP framework written in Go (Golang), built with message router. EasyTCP helps you build a TCP server easily fast and less painful.
Stars: ✭ 416 (+117.8%)
Mutual labels:  router
Go Html Boilerplate
Starter pack for doing web development in Go
Stars: ✭ 229 (+19.9%)
Mutual labels:  router
dilovel
An advanced framework is written in PHP, a framework containing rich components such as middleware, orm, request management, template engine, elasticsearch, template engine, many modern frameworks have been written by adopting clean code principles completely written in accordance with PHP standards. like linux operating system ...All of control…
Stars: ✭ 38 (-80.1%)
Mutual labels:  router
routex.js
🔼 Alternative library to manage dynamic routes in Next.js
Stars: ✭ 38 (-80.1%)
Mutual labels:  router
journey
A conductor routing helper library
Stars: ✭ 35 (-81.68%)
Mutual labels:  router
lura
Ultra performant API Gateway with middlewares. A project hosted at The Linux Foundation
Stars: ✭ 5,159 (+2601.05%)
Mutual labels:  router

@swan-io/chicane logo

@swan-io/chicane

mit licence npm version bundlephobia

A simple and safe router for React and TypeScript.

Design principles

  • Typed routes: improving the DX, and making sure all your params are here!
  • Component-friendly: the router nicely fits in your React app.
  • Easy-to-use: naming routes instead of moving around unsafe URLs.
  • Performant: avoids any unnecessary render.

Installation

$ yarn add @swan-io/chicane
# --- or ---
$ npm install --save @swan-io/chicane

Links

Quickstart

import { createRouter } from "@swan-io/chicane";
import { match } from "ts-pattern";

const Router = createRouter({
  Home: "/",
  Users: "/users",
  User: "/users/:userId",
});

const App = () => {
  const route = Router.useRoute(["Home", "Users", "User"]);

  // route object is a discriminated union
  return match(route)
    .with({ name: "Home" }, () => <h1>Home</h1>)
    .with({ name: "Users" }, () => <h1>Users</h1>)
    .with({ name: "User" }, ({ params }) => <h1>User {params.userId}</h1>) // params are strongly typed
    .otherwise(() => <h1>404</h1>);
};

Run the example app

$ git clone [email protected]:swan-io/chicane.git
$ cd chicane/example

$ yarn install && yarn dev
# --- or ---
$ npm install && npm run dev

🙌 Acknowledgements

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].