Before routing
In HTML url links were used to navigate between pages. Each page triggered a page reload which ment the server had to render every page separately. Updating or scaling these applications required changing the entire codebase as one large unit. In new applications designed with filing systems that sort the code so it can be updated by teams. This makes it easier for multiple developers to work on the same codebase at once. This method of working is know as micro-servicing.
Routing in react
React is a javascript library developed by Meta formally know as Facebook inc. React-router is the preferred method of navigation between different pages. React does not include routing by default when create-react-app is started. There are a few option for routing in react:
Single-page apps (SPA)
Streaming Server-side rendering (SSR) No components, everything is done in one page.
Static site generation (SSG) Nested routes, links and classes.
React Server Components (RSC)
Alternatives to React Routing
In other popular javascript frameworks like Next.js routing is preformed differently. In Vue.js routing is expensive, configurable upon starting a new npm create vue@latest project as option. Choosing to install Vue Router will enable some core features to handle routing. Generally react-router-don is the most popular choice within JavaScript frameworks. It’s very conductive, smooth and reliable for many use cases.
Conciliation
React.js applications have a big foot print on the World Wide Web. Many leading companies use it on the websites and applications. React-router-dom is the perfect choice when you next deploy your app to web.
Top comments (0)