Demo: https://heineiuo.github.io/react-router-stack-switch/index.html
yarn add react-router-stack-switch
import React from 'react';
import { HashRouter, Route } from "react-router-dom";
import { StackSwitch } from "react-router-stack-switch";
const App: React.FC = () => {
return (
<HashRouter>
<StackSwitch>
<Route path="/" exact component={Home}></Route>
<Route path="/learn/:chapter" exact component={Learn}></Route>
</StackSwitch>
</HashRouter>
);
};
See: /src/App.tsx
MIT License