Obtener datos de un axios a otro en ComponentDidMount
componentDidMount() {
const {
match: { params }
} = this.props;
axios
.get(`/api/topics/${params.TopicId}`)
.then(response => {
this.setState({ topic: response.data });
return axios.get(`/api/users/${response.data.user_id}`);
})
.then(response => {
this.setState({ user: response.data });
})
.catch(function(error) {
console.log(error);
});
}
Dark Donkey