reactjs

react router

日期:2019-11-07 阅读:690

dmandwp系统 - wordpress系统和DM系统区块建站>>

https://www.npmjs.com/package/react-router-dom

安装: 

npm install -g create-react-app
create-react-app demo-app
cd demo-app

---------

npm start

npm run build

-------

npm install react-router-dom

 

https://reacttraining.com/react-router/web/guides/quick-start/1st-example-basic-routing

 

http://react-guide.github.io/react-router-cn/docs/Introduction.html 

-----------------

https://www.sitepoint.com/react-router-complete-guide/

https://github.com/sitepoint-editors/react-router-demo

You need a router component and several route components to set up a basic route as exemplified above. Since we’re building a browser-based application, we can use two types of routers from the React Router API:

<BrowserRouter>
<HashRouter>


The primary difference between them is evident in the URLs that they create:

// <BrowserRouter>
http://example.com/about

// <HashRouter>
http://example.com/#/about


The <BrowserRouter> is more popular amongst the two because it uses the HTML5 History API to keep track of your router history. The <HashRouter>, on the other hand, uses the hash portion of the URL (window.location.hash) to remember things. If you intend to support legacy browsers, you should stick with <HashRouter>.

--------------------

 

 

 

<<点击返回