You're using function()
in your Promise chain, this will change the scope for this
. If you're using ES6 I suggest you use the arrow function to maintain the class scope. Example:
You're using
axios.get(APP_URL, { params: params}) .then(function(response) { // this resets the scope this.setState({ videos:response }) })
Try using arrow functions:
axios.get(APP_URL, { params: params})
.then((response) => {
this.setState({
videos:response
})
})