React router v6 changes

 

Photo by Lautaro Andreani on Unsplash
  1. No <Switch> anymore. Nested routes
<Routes>
<Route
path="invoices/:invoiceId"
element={<Invoice />}
/>
</Routes>
const withRouter = WrappedComponent => props => {
const params = useParams();
// etc... other react-router-dom v6 hooks

return (
<WrappedComponent
{...props}
params={params}
// etc...
/>
);
};
export default withRouter(Post);

Popular posts from this blog

Fancyapps — easily build overlay windows with carousel

Thoughts about Progressive Web App

Meet Mantine: A TS-Based Open-Source React Components Library