InterviewHubPRO
Section Overview
Q170

Question 170 of 445

Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

38%
React & Modern Frontend (445 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

What are the benefits of React Router V4?

Below are the main benefits of React Router V4 module,

  1. In React Router v4(version 4), the API is completely about components. A router can be visualized as a single component(<BrowserRouter>) which wraps specific child router components(<Route>).
  2. You don't need to manually set history. The router module will take care history by wrapping routes with <BrowserRouter> component.
  3. The application size is reduced by adding only the specific router module(Web, core, or native)

Practical Code Example

jsx
// React Router v4/v5/v6 benefit: Declarative, component-based routing ("Everything is a Component")