Reputation: 1
I compiled a react code and it was showing successful compiled in my terminal but i don't know why this error is coming on chrome.
This is the code:
render() {
const filteredRobots =this.state.robots.filter(robot => {
return (robots.name.**includes**( this.state.serchfeild ))
})
}
Upvotes: 0
Views: 153
Reputation: 23
You have used wrong variable name inside arrow function. You need to use robot.name
instead of robots.name
. Below is correct code:
render() {
const filteredRobots =this.state.robots.filter(robot => {
return (robot.name.includes( this.state.serchfeild ))
})
}
Upvotes: 1