1.3.0 • Published 3 years ago

route-link v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Install

npm i route-link

Example Usage

import { route, extend } from "route-link";

const posts = route("/posts");
const post = extend(posts, '/:post_id')

// generate type safe links
posts.link() // /posts
post.link({ post_id: "1" }); // /posts/1

// match URLs to path
post.match(post.link({ post_id: "1" })) // { post_id: "1" };
post.match("/foo")) // false

// use route path
<Route path={post.path}/>

as a convivnce, link and match are also exported separately

Credits

1.2.0

3 years ago

1.1.0

3 years ago

1.3.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago