Declarative router
import Router from 'uc-router'
const router = new Router((name, params) =>
console.log(name, params)
)
router
.add('post', '/posts(/:id)')
.add('index', '/');
router.start();
Adds new route with the name
.
Deletes a route with the name
.
Starts the router and checks the current URL
Navigates to url
. If url
is the same as current does nothing. However, if you add !
symbol to the beginning of the url
forces the router to it check again.
Replaces the current state with url
and state
.
Goes back in history if previous state exists. Else navigates to the path
.
Removes the router
License MIT
© velocityzen