nassem1
12/11/2019 - 4:30 PM

how search in react

/* search item */
state = {
  user:[],
  search: ''
}
this.setState({users : this.state.users.fliter(user=>{
  user.name.includes(this.state.search)
})})


/* how to filter the props value */
<div>
  {
    this.state.items.filter((item , index ) => index < 5 ).map(item =>(
      <div>{item.name}</div>
    ))
  }
</div>