react-slide-routes

The easiest way to slide React routes

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-slide-routes
8903.0.3a year ago4 years agoMinified + gzip package size for react-slide-routes in KB

Readme

react-slide-routes 🏄‍♂️
The easiest way to slide React routes
npm npm npm bundle size npm peer dependency version npm peer dependency version GitHub

Fit

React Router v6
For React Router v5, please use react-slide-routes@1.1.0 and note that the usage is different.

Add

```shell script yarn add react-slide-routes
or
npm i react-slide-routes
## Use

```jsx
import { Route } from 'react-router-dom';
import SlideRoutes from 'react-slide-routes';

const App = () => (
  <SlideRoutes>
    <Route path="/" element={<Home />} />
    <Route path="/about" element={<About />} />
    <Route path="/contact" element={<Contact />} />
  </SlideRoutes>
);

Live

Play a live demo here → 🤳
live

API

| Prop | Type | Required | Default | Description | | ----------- | ---------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | animation | string | | 'slide' | Animation effect type, 'slide', 'vertical-slide', or 'rotate' | | duration | number | | 200 | transition-duration in ms | | timing | string | | 'ease' | transition-timing-function, one of 'ease' 'ease-in' 'ease-out' 'ease-in-out' 'linear' | | destroy | boolean | | true | If false, prev page will still exits in dom, just invisible | | compare | function | | - | Function to sort the routes' order (defaults to the definition order). compare will be used to routes.sort((a, b) => compare(a, b)), routes is the param to useRoutes |

License

MIT License © nanxiaobei

FUTAKE

If you use WeChat, please try "FUTAKE". It's a WeChat mini app for your inspiration moments. 🌈
FUTAKE