Header.js
import React, {Component} from "react";
import { BrowserRouter as Router, Route, Link, Switch, withRouter, browserHistory, IndexRoute } from "react-router-dom";
...
<Router>
<Switch>
<Route path="/PSli" render={(props) => <PSli text="Hello, " {...props} />} />
</Switch>
</Router>
PSli.js
import React, {Component} from "react"
class PSli extends Component {
constructor(props) {
super(props)
this.state = {
loading: true,
timer: true,
numOfSlides: 4,
whichSlideActive: 0,
slideData: {}
}
}
componentDidMount() {
console.log("mounted" + this.props.text)
this.setState({
loading: false
})
}
render() {
return (
<div>
</div>
)
}
}
export default PSli
道具怎么没从Header
发送到PSli
。