Issue is with products data quality field and selectOption fields , they are is matched
It tries to compare the products data quality with selectOption's key
So either you change products
const products = [
{"id": "1", "name":"john", "quality":"unknown"},
{"id": "2", "name":"jane", "quality":"good"},
{"id": "3", "name":"bob", "quality":"Bad"},
{"id": "4", "name":"ralph", "quality":"Bad"},
]
To :
const products = [
{"id": "1", "name":"john", "quality":2},
{"id": "2", "name":"jane", "quality":0},
{"id": "3", "name":"bob", "quality":1},
{"id": "4", "name":"ralph", "quality":1},
]
WORKING DEMO
OR
change selectOptions to :
const selectOptions = {
'good' : 'good',
'Bad' : 'Bad',
'unknown' : 'unknown',
};
const handleClick = () => {
qualityFilter('good'); // <---- here to
};
WORKING DEMO