Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

streamich/react-router-lite

Repository files navigation

Similar toreact-router but leaner.

Provide your route in the[route] prop to theRouter component and usetheRoute components to define your routes.

import{Router,Route}from'react-router-lite';<Routerroute="/foo/bar"><Route><span>1</span></Route><Routematch="/baz"><span>2</span></Route><Routematch="/foo"><span>3</span></Route><Routematch="/foo/bar"><span>4</span></Route></Router>;

You can use theSwitch component to render only the first route that matches.

import{Router,Switch,Route}from'react-router-lite';<Routerroute={'/any/string/goes/here'}><Switch><Routematch="/any/string"render={()=><div>hello world</div>}><Routematch="/any/string/goes"render={()=><div>not hello</div>}></Switch></Router>

The routes can be nested. When[truncate] prop is set, the nested routes willbe truncated to the parent route.

import{Router,Route}from'react-router-lite';<Routerroute="/foo/bar"><Routematch={'/foo'}truncate><span>foo</span><Routematch="/bar"><span>bar</span></Route></Route></Router>;

License

Unlicense — public domain.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp