- React Router Quick Start Guide
- Sagar Ganatra
- 260字
- 2021-07-23 16:41:33
Configuring Routes - Using Various Options in the Route Component
React-Router allows you to declaratively define routes using the <Route> component. It's the main building block of React-Router, and renders the component mentioned in the component prop when the path value mentioned in the path prop matches the browser's URL location. The <Route> component, like any other React component, accepts a set of props. These props provide more granular control over how the browser's URL path should match the <Route> component's path, and a couple of other rendering options as well.
In the previous chapter, we briefly saw how a <Route> component is used to match the URL path and render a component. In this chapter, we will take a look at the following:
- A deep dive into various props that can be added to a <Route> component, such as exact, strict, render, children, and sensitive.
- Route component props: the component, which gets rendered as a result of a <Route> path match, receives data as props that can then be used to create nested routes.
- Route parameters: The <Route> component's path can be configured to accept additional params from the URL segment, and these params can be read in the rendered component.
- Nested or dynamic routes: a <Route> component can be added inside a rendered component instead of defining routes at the application level. The rendered component thus provides the next step in the application journey.
- Generating routes from JSON configuration: Route information available in the JSON object can be used to add routes to the application.
推薦閱讀
- Manga Studio Ex 5 Cookbook
- 算法訓(xùn)練營:入門篇(全彩版)
- Spring Boot+Spring Cloud+Vue+Element項(xiàng)目實(shí)戰(zhàn):手把手教你開發(fā)權(quán)限管理系統(tǒng)
- Getting Started with CreateJS
- Access 2016數(shù)據(jù)庫管
- KnockoutJS Starter
- C語言程序設(shè)計(jì)
- Building Machine Learning Systems with Python(Second Edition)
- Node.js區(qū)塊鏈開發(fā)
- 愛上C語言:C KISS
- Java并發(fā)實(shí)現(xiàn)原理:JDK源碼剖析
- 少兒編程輕松學(xué)(全2冊(cè))
- Java服務(wù)端研發(fā)知識(shí)圖譜
- 零基礎(chǔ)學(xué)Java(第5版)
- Mastering R for Quantitative Finance