All Projects → carloslfu → use-router-machine

carloslfu / use-router-machine

Licence: MIT license
Router state-machine hook, powered by XState (DEPRECATED).

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to use-router-machine

xstate.dart
xstate for dart & flutter
Stars: ✭ 31 (+181.82%)
Mutual labels:  statecharts, xstate
xstate-react-router
XState connector to React Router.
Stars: ✭ 23 (+109.09%)
Mutual labels:  statecharts, xstate
roover
🐱 A lightweight audio library for React apps.
Stars: ✭ 70 (+536.36%)
Mutual labels:  xstate, react-hook
ember-statecharts
Statecharts for Ember.js applications
Stars: ✭ 67 (+509.09%)
Mutual labels:  statecharts, xstate
qlevar router
Manage you project Routes. Create nested routes. Simply navigation without context to your pages. Change only one sub widget in your page when navigating to new route.
Stars: ✭ 51 (+363.64%)
Mutual labels:  router
imove
INACTIVE: Move your mouse, generate code from flow chart
Stars: ✭ 3,598 (+32609.09%)
Mutual labels:  xstate
es6-router
🌐 Simple client side router built in ES6
Stars: ✭ 16 (+45.45%)
Mutual labels:  router
tulingx
TULINGX(图灵)VPN下载页 翻墙 代理 科学上网 外网 加速器 梯子 路由
Stars: ✭ 59 (+436.36%)
Mutual labels:  router
RouteNow
RouteNow is a small fast library ⚡ that will help you in developing a SinglePage Application without any dependencies like jQuery, AngularJs, vue.js or any of those bulky frameworks.
Stars: ✭ 17 (+54.55%)
Mutual labels:  router
orion
A Crystal router
Stars: ✭ 115 (+945.45%)
Mutual labels:  router
react-chicane
A simple and safe router for React and TypeScript.
Stars: ✭ 191 (+1636.36%)
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 (+118.18%)
Mutual labels:  router
Parrot
Web router specially designed for building SPAs using Meteor
Stars: ✭ 75 (+581.82%)
Mutual labels:  router
arc-progress
🐳 Arc circular animation progress bar drawn by canvas, you can used in the react component, or no dependence.
Stars: ✭ 42 (+281.82%)
Mutual labels:  react-hook
use-react-router-breadcrumbs
tiny, flexible, hook for rendering route breadcrumbs with react-router v6
Stars: ✭ 170 (+1445.45%)
Mutual labels:  router
lura
Ultra performant API Gateway with middlewares. A project hosted at The Linux Foundation
Stars: ✭ 5,159 (+46800%)
Mutual labels:  router
routex.js
🔼 Alternative library to manage dynamic routes in Next.js
Stars: ✭ 38 (+245.45%)
Mutual labels:  router
Android-XRouter
This is a lightweight and simple routing framework that provides jump routing and method routing.
Stars: ✭ 19 (+72.73%)
Mutual labels:  router
fast-route
PSR-15 middleware to use FastRoute
Stars: ✭ 91 (+727.27%)
Mutual labels:  router
journey
A conductor routing helper library
Stars: ✭ 35 (+218.18%)
Mutual labels:  router

use-router-machine

⚠️ DEPRECATED, use useRouterMachine from xstate-router instead.

Hook that let's you use XState as a router, by using the meta property.

Live example: https://codesandbox.io/s/8n06pwy61l

Use

Install the library with npm i use-router-machine.

import { useRouterMachine } from 'use-router-machine'

const config = {
  initial: 'home',
  states: {
    home: { meta: { path: '/' }, on: { NEXT: 'about' } },
    about: { meta: { path: '/about' }, on: { NEXT: 'dashboard' } },
    dashboard: {
      meta: { path: '/dashboard' },
      initial: 'login',
      on: { NEXT: 'home' },
      states: {
        loggedIn: {
          initial: 'main',
          states: {
            main: { meta: { path: '/dashboard/main' } },
            data: { meta: { path: '/dashboard/data' } }
          }
        },
        login: {
          meta: { path: '/dashboard/login' },
          on: { LoggedIn: 'loggedIn' }
        }
      }
    }
  }
}

function App() {
    const service = useRouterMachine({ config })

    return <div>{service.state.value}</div>
}
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].