Skip to content

Latest commit

Β 

History

History
69 lines (48 loc) Β· 3.17 KB

README.md

File metadata and controls

69 lines (48 loc) Β· 3.17 KB

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 version >=4.0.0 and <6.0.0

Add

yarn add react-slide-routes

# or

npm install react-slide-routes

Use

import SlideRoutes from 'react-slide-routes';
import { Route, useLocation } from 'react-router-dom';

const App = () => {
  const location = useLocation();
  return (
    <SlideRoutes location={location}>
      <Route path="/" component={Home} exact />
      <Route path="/about" component={About} />
      <Route path="/contact" component={Contact} />
    </SlideRoutes>
  );
};

Live

Play a live demo here β†’ 🀳

live

API

Prop Type Required Default Description
location object yes location location from react-router-dom, required
animation string 'slide' Animation effect type, 'slide', 'vertical-slide', or 'rotate'
pathList array [] Pre-defined pathname list, useful when enter a url, you want to "back" to some url (default "forward")
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, the passed page will still exits in dom, only invisible

License

MIT License Β© nanxiaobei

Pitiless Ads

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

FUTAKE