All Projects → Steveeeie → React Page Transition

Steveeeie / React Page Transition

Licence: mit
A React component that makes it easy to use the page transitions from the Codedrops page transitions demo with React

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Page Transition

Flag Project React
Awesome stack, awesome project pls press the star button
Stars: ✭ 278 (+91.72%)
Mutual labels:  styled-components, react-router
React Ssr Starter
All have been introduced React environment
Stars: ✭ 20 (-86.21%)
Mutual labels:  styled-components, react-router
React Tiger Transition
Full page transitions with react-router.
Stars: ✭ 431 (+197.24%)
Mutual labels:  page-transitions, react-router
book-manager
A simple personal library management application.
Stars: ✭ 48 (-66.9%)
Mutual labels:  react-router, styled-components
React Bootstrap Webpack Starter
ReactJS 16.4 + new React Context API +react Router 4 + webpack 4 + babel 7+ hot Reload + Bootstrap 4 + styled-components
Stars: ✭ 103 (-28.97%)
Mutual labels:  styled-components, react-router
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-84.83%)
Mutual labels:  transitions, page-transitions
React Redux Saga Boilerplate
Starter kit with react-router, react-helmet, redux, redux-saga and styled-components
Stars: ✭ 535 (+268.97%)
Mutual labels:  styled-components, react-router
razzle-template
SSR template with React, Effector, TypeScript, ReactRouter, and StyledComponents
Stars: ✭ 62 (-57.24%)
Mutual labels:  react-router, styled-components
Molecule
⚛️ – :atom: – ⚛️ Boilerplate for cross platform web/native react apps with electron.
Stars: ✭ 95 (-34.48%)
Mutual labels:  styled-components, react-router
Koa React Notes Web
🤓 A simple SPA built using Koa (2.5.1) as the backend and React (16.4.1) as the frontend. Features MySQL integration, user authentication, CRUD note actions, and more.
Stars: ✭ 61 (-57.93%)
Mutual labels:  styled-components, react-router
transitionable-routes
Perform transitions when changing routes with React Router
Stars: ✭ 26 (-82.07%)
Mutual labels:  react-router, transitions
Reeakt
A modern React boilerplate to awesome web applications
Stars: ✭ 116 (-20%)
Mutual labels:  styled-components, react-router
molecule
⚛️ –  – ⚛️ Boilerplate for cross platform web/native react apps with electron.
Stars: ✭ 95 (-34.48%)
Mutual labels:  react-router, styled-components
react-template
An enterprise react template application showcasing - Testing strategy, Global state management, middleware support, a network layer, component library integration, localization, PWA support, route configuration, lazy loading and CI/CD
Stars: ✭ 44 (-69.66%)
Mutual labels:  react-router, styled-components
reactube-client
A clone Youtube Web Player using React Provider Pattern, React Context and Typescript
Stars: ✭ 92 (-36.55%)
Mutual labels:  react-router, styled-components
React Motion Layout
🦸 Beautiful immersive React hero animations.
Stars: ✭ 509 (+251.03%)
Mutual labels:  transitions, react-router
React Router Native Stack
A stack navigation component for react-router-native
Stars: ✭ 171 (+17.93%)
Mutual labels:  transitions, react-router
Frontend
마음을 잇는 현명한 소비 '잇다'🤝
Stars: ✭ 19 (-86.9%)
Mutual labels:  react-router, styled-components
Muiscrr Boilerplate
Material-UI Styled Components React Redux boilerplate with offline mode support 🎬
Stars: ✭ 35 (-75.86%)
Mutual labels:  styled-components, react-router
Road Beyond React App
🌈 The Road beyond React - Thing you can use after learning plain React.js
Stars: ✭ 108 (-25.52%)
Mutual labels:  styled-components, react-router

License Version Size PRs Twitter Follow

React Page Transition

⚛️💨 A React component that makes it easy to use the page transitions from the Codedrops Page Transitions Demo See Original.

View Basic Demo

View Advanced Demo


preview
preview


Usage with react-router

1. Install Package

npm install @steveeeie/react-page-transition

or

yarn add @steveeeie/react-page-transition


2. Install Dependencies

npm install react-router react-router-dom react-transition-group styled-components

or

yarn add react-router react-router-dom react-transition-group styled-components


3. Code Example

App.js

import React from 'react';
import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
import { PageTransition } from '@steveeeie/react-page-transition';
import './styles.css';

const Links = () => (
  <>
    <Link to="/">Home</Link>
    <Link to="/about">About</Link>
  </>
);

const Home = props => <h1>Home</h1>;

const About = props => <h1>About</h1>;

export default function App() {
  return (
    <BrowserRouter>
      <Links />
      <Route
        render={({ location }) => {
          return (
            <PageTransition
              preset="moveToLeftFromRight"
              transitionKey={location.pathname}
            >
              <Switch location={location}>
                <Route exact path="/" component={Home} />
                <Route exact path="/about" component={About} />
              </Switch>
            </PageTransition>
          );
        }}
      />
    </BrowserRouter>
  );
}

Wrap your routes inside the PageTransition component and pass one of the preset names to the preset prop. View the advanced demo for the full list of presets.

You will also need to pass the current location.path to the transitionKey prop, this is so that the internal TransitionGroup can track which components are entering and exiting.


styles.css

html,
body,
#root {
  height: 100%;
}

PageTransition is styled with height: 100%. The parent containers need to be given a height for it to render correctly because of this.


Props

Prop Required Type Description
preset No String Sets the enter and exit animations *
enterAnimation No String Sets the enter animation *
exitAnimation No String Sets the exit animation *
transitionKey Yes Unique Identifier Used internally to track which components are entering and exiting.
* View the advanced demo for the full list of presets and animations.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].