完整代碼:
成都網(wǎng)站建設哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設計、重慶網(wǎng)站建設公司、微信開發(fā)、小程序開發(fā)、集團企業(yè)網(wǎng)站建設等服務項目。核心團隊均擁有互聯(lián)網(wǎng)行業(yè)多年經(jīng)驗,服務眾多知名企業(yè)客戶;涵蓋的客戶類型包括:陽臺護欄等眾多領域,積累了大量豐富的經(jīng)驗,同時也獲得了客戶的一致稱譽!
var React = require('react')
var ReactDom = require('react-dom')
var ReactRouter = require('react-router-dom')
var Router = ReactRouter.BrowserRouter
var Route = ReactRouter.Route
var Link = ReactRouter.Link
var browserHistory = ReactRouter.browserHistory
var CreateClass = require('create-react-class')
var PropTypes = require('prop-types')
var Index = CreateClass({
render:function(){
return (
- Home
- About
- Docs
)
}
})
var Home = CreateClass({
render:function(){
return(
Home
)
}
})
var About = CreateClass({
render:function(){
return(
About
)
}
})
var Docs = CreateClass({
render:function(){
return(
- Step1
)
}
})
var Step1 = CreateClass({
onClick:function(){
var history = this.props.history
history.push('/')
},
render:function(){
return(
回到主頁
Step1
)
}
})
ReactDom.render((
), document.body)
var ReactRouter = require('react-router-dom')
var withRouter = ReactRouter.withRouter
b. 使用:
this.props.history.push("/")
c. 導出:
module.exports = withRouter(Login)
var Router = ReactRouter.HashRouter
b. 使用:
var Switch = ReactRouter.Switch
b. 定義: