Reader small image

You're reading from  React Router Quick Start Guide

Product typeBook
Published inSep 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781789532555
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Sagar Ganatra
Sagar Ganatra
author image
Sagar Ganatra

Sagar Ganatra is a frontend engineer and an architect from Bangalore, India. He has more than a decade of experience in developing web and mobile applications. He specializes in architecting projects using JavaScript and frameworks such as React, Angular, and Node. His previous books include Kendo UI Cookbook and Instant Kendo UI Mobile, both published by Packt Publishing. He also writes about frontend technologies in his blog, sagarganatra (dot) com.
Read more about Sagar Ganatra

Right arrow

Getting started with connected-react-router

The connected-react-router library provides Redux bindings for React Router; for example, the application's history can be read from a Redux store and you can navigate to different routes in the application by dispatching actions to the store.

Let's first install connected-react-router and other libraries using npm:

npm install --save connected-react-router  react-router  react-router-dom  history

Next, we will update the store settings.

In index.js:

import { applyMiddleware, createStore, compose } from 'redux';
import { ConnectedRouter, connectRouter, routerMiddleware } from 'connected-react-router';

const history = createBrowserHistory();

const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(
connectRouter(history)(rootReducer...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
React Router Quick Start Guide
Published in: Sep 2018Publisher: PacktISBN-13: 9781789532555

Author (1)

author image
Sagar Ganatra

Sagar Ganatra is a frontend engineer and an architect from Bangalore, India. He has more than a decade of experience in developing web and mobile applications. He specializes in architecting projects using JavaScript and frameworks such as React, Angular, and Node. His previous books include Kendo UI Cookbook and Instant Kendo UI Mobile, both published by Packt Publishing. He also writes about frontend technologies in his blog, sagarganatra (dot) com.
Read more about Sagar Ganatra