I was following the answer in this question to filter a key-value pair in JS.
I have an Object of key-value pairs. I am trying to do something like this
{
Object.entries(this.state.passengers)
.filter(([key, passenger]) => passenger.flightNumber === this.props.flightNumber)
.map(([key, passenger]) => {
return (
<tr key = {key}>
//...JSX code
)
})
}
I get the warnings in console that key is not used. I am not finding the right syntax to avoid passing key as an argument to filter method. I want to pass the key to subsequent map method though. Please help. I am new to JS.