官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 壶关县| 蓬安县| 盐边县| 黔西| 合阳县| 东方市| 鹿邑县| 博湖县| 临泉县| 温泉县| 吉林省| 海丰县| 肃宁县| 自治县| 高邮市| 女性| 高陵县| 小金县| 交口县| 安阳县| 汉川市| 通海县| 锡林浩特市| 福泉市| 台东县| 林周县| 安塞县| 临潭县| 临漳县| 平顺县| 平谷区| 类乌齐县| 木兰县| 浮山县| 稷山县| 高清| 南江县| 淮北市| 新乡市| 正蓝旗| 石阡县|