
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-router-animated-switch
Advanced tools
This module is an alternative to the react-router `<Switch>` component. The behaviour is identical, except that it includes a super slick animation to transition between pages.
This module is an alternative to the react-router <Switch> component. The
behaviour is identical, except that it includes a super slick animation to
transition between pages.
It adds two divs. An outer one, that wrapps all the pages, and an inner one for
each page. You can style them via style/className and
itemStyle/itemClassName respectively.
yarn add react-router-animated-switch
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import styled from 'styled-components';
import {BrowserRouter, Route, Link} from 'react-router-dom';
import Switch from '@moped/react-router-animated-switch';
import ArticleA from './ArticleA';
import ArticleB from './ArticleB';
import ArticleC from './ArticleC';
import ArticleD from './ArticleD';
const App = styled.main`
display: flex;
flex-direction: column;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
`;
const Footer = styled.nav`
display: flex;
`;
const FooterLink = styled(Link)`
display: flex;
align-items: center;
justify-content: center;
flex-grow: 1;
text-decoration: none;
color: white;
height: 5em;
background: black;
:not(:last-child) {
border-right: 1px solid lightgray;
}
`;
const container = document.createElement('div');
document.body.appendChild(container);
ReactDOM.render(
<BrowserRouter>
<App>
<Switch style={{flexGrow: 1}} itemStyle={{overflow: 'scroll'}}>
<Route path="/" exact={true} component={ArticleA} />
<Route path="/b" exact={true} component={ArticleB} />
<Route path="/c" exact={true} component={ArticleC} />
<Route path="/d" exact={true} component={ArticleD} />
</Switch>
<Footer>
<FooterLink to="/">A</FooterLink>
<FooterLink to="/b">B</FooterLink>
<FooterLink to="/c">C</FooterLink>
<FooterLink to="/d">D</FooterLink>
</Footer>
</App>
</BrowserRouter>,
container,
);
MIT
FAQs
This module is an alternative to the react-router `<Switch>` component. The behaviour is identical, except that it includes a super slick animation to transition between pages.
We found that react-router-animated-switch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.