Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between BrowserRouter(import from react-router-dom) and ConnectedRouter(import from connected-react-router/immutable)?

import { ConnectedRouter } from 'connected-react-router/immutable';
import { BrowserRouter as Router,} from 'react-router-dom';

i need to know difference between above both of them.

like image 722
Muhammad Sulman Avatar asked Dec 27 '18 10:12

Muhammad Sulman


People also ask

What is the difference between router and BrowserRouter react?

At the core of every React Router application should be a router component. For web projects, react-router-dom provides <BrowserRouter> and <HashRouter> routers. The main difference between the two is the way they store the URL and communicate with your web server. A <BrowserRouter> uses regular URL paths.

What is the difference between react dom and react router dom?

The primary difference between them lies in their usage. React Router DOM is for web applications and React Router Native is for mobile applications made with React Native.

What is BrowserRouter react router dom?

React Router is a standard library for routing in React. It enables navigation between views from different components in a React application, allows the browser URL to be changed, and keeps the UI in sync with the URL.

What is ConnectedRouter in react?

ConnectedRouter is to be used with Redux and can synchronize router state with a Redux store. BrowserRouter is the 'standard' React router for the browser, to keep the UI in sync with the current URL.


2 Answers

ConnectedRouter is to be used with Redux and can synchronize router state with a Redux store.
BrowserRouter is the 'standard' React router for the browser, to keep the UI in sync with the current URL.

like image 89
Laurens Deprost Avatar answered Sep 23 '22 15:09

Laurens Deprost


The main difference in connected-react-router/immutable in is that history is stored in redux as immutable object so you can timetravel your history any time in the redux-life of the application.

like image 20
Mosè Raguzzini Avatar answered Sep 21 '22 15:09

Mosè Raguzzini