Answer the question
In order to leave comments, you need to log in
How to pass state between routes?
I welcome everyone!
I continue to study the mechanisms of this wonderful library. And then the question arose, subject. For example, we have such a router of two pages:
class Content extends React.Component {
render() {
return (
<Switch>
<Route exact path="/" component={Home} />
<Route path="/sqlshell" component={Contacts} />
</Switch>
)
}
}
class Content extends React.Component {
constructor(props, context) {
super(props, context)
this.state = {
data1: null,
data2: null,
}
}
render() {
return (
<Switch>
<Route exact path="/" component={Home} />
<Route path="/sqlshell" component={Contacts} />
</Switch>
)
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question