完整代码:
成都网站建设哪家好,找创新互联!专注于网页设计、重庆网站建设公司、微信开发、小程序开发、集团企业网站建设等服务项目。核心团队均拥有互联网行业多年经验,服务众多知名企业客户;涵盖的客户类型包括:阳台护栏等众多领域,积累了大量丰富的经验,同时也获得了客户的一致称誉!
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. 定义: