So I am trying to make call axios.get('{link here}') from componentDidMount() of parent:
class Parent extends React.Component {
constructor(){
super();
this.state = {
stuff: []
}
}
componentDidMount() {
axios.get({link})
.then(res => {
this.setState({stuff: res.data})
}
}
render() {
return(
<Child stuff={this.state.stuff} />
)
}
Then there is Child various child components, one of which is like:
class Child extends React.Component {
constructor(props) {
super(props);
}
render() {
return(
//To access everything in the data of parent here in child component
)
}
Even though the parent shows data in console.log(), the child is not receiving anything