I am new and studying React. I am trying to make a search filter, I followed the youtube and made a function. But it did not work with the error "Array.prototype.filter() expects a value to be returned at the end of arrow function array-callback-return". I have done everything. It still did not work. Anyone help please.
const boards = this.state.boards.filter((board)=>{
if(this.state.search == null)
return board
else if(board.title.toLowerCase().includes(this.state.search.toLowerCase()) || board.content.toLowerCase().includes(this.state.search.toLowerCase())){
return board
}
}).map(board=>{
return(
<tr key = {board.idx}>
<td> {board.idx} </td>
<td><button className="btn btn-link" onClick = {() => this.BoardDetail(board.idx)}> {board.title}</button></td>
<td> {board.insertTime} </td>
<td> {board.updateTime} </td>
<td> {board.viewCnt} </td>
</tr>
)
})