TILT-REACT Router
Now to see how to handle FrontEnd routing ( From Backend it is simple – just transfer to index.html and React will handle it )
The long established in React world seems to be https://github.com/remix-run/react-router . There is a new kid , https://github.com/Paratron/hookrouter – that uses hooks. However, the documentation says:
This project is not and will not be written in typescript.
So back to the old react router.
To register you need:
- Some routes
<Routes> <Route path="/" element={<PublicTilts />} /> <Route path="/public/:id" element={<OnePublicTiltComponent />} /> {/* <Route path="*" element={<NotFound />} /> */} </Routes>
- And intercept
function OnePublicTiltComponent() : JSX.Element{ let { id } = useParams(); //code }
However, when I look to Angular and React, the code in React ( with Hooks) seems more clean and usable. Just the render and the functions.
Leave a Reply