I have a handler that fires upon change in the input field. However, when I log the state to the console resData is 'undefined'? It's impossible because console.log(body) does return results.
handlePersonNameChange(event) {
var resData
request('https://swapi.co/api/people/?search='+event.target.value, function (error,response,body) {
console.log(body)
resData = body
})
this.setState({personData: resData});
console.log(this.state)
}