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

Summary

React is a JavaScript library used to build user interfaces. Unlike libraries such as Angular and Ember, which include a routing package, the React library does not include any components or services that help in routing. React-Router is a routing library that can be used in any React application, web or native. React-Router version 4 is a complete rewrite of the earlier versions and all of its components are written in React. The library includes the packages react-router-dom for use in web applications; react-router-native, for use in native applications built with React-Native; and react-router, a core package that both react-router-dom and react-router-native have a dependency on.

The create-react-app CLI is used to quickly scaffold a React application. It includes build configuration scripts that can be used to generate builds for development and production environments. The react-router-dom package is then added as a dependency to the application. The package includes the <BrowserRouter> component, which implements a History interface. The application's root component, <App />, is wrapped inside React-Router's <BrowserRouter> component to make the History object available to all the components in the application tree.

To create our first route, the <Route> component is included. It accepts path and component as props, and renders the component when the browser's URL matches the <Route> path.

In Chapter 2, Configuring Routes - Using Various Options in the Route Component, the <Route> component props are discussed in detail. Also, we will take a look at the various props that the rendered component receives, and consider how these props can be used to create nested routes.

Previous PageNext Chapter
You have been reading a chapter from
React Router Quick Start Guide
Published in: Sep 2018Publisher: PacktISBN-13: 9781789532555
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

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