How in JS to filter a value on a condition from a map
Solution 1:
I think your problem is here:
const result = disqualificationReasons.map(({ message, value }) => ({
message
}));
brackets are not necessary. So you could write:
const result = disqualificationReasons.map(({ message, value }) => message);
Then in your html the filter is wrong because you are filtering using value
but disqualificationReasons
has message
. So the filter should be:
<div>${result
.filter((value) => value !== "Screen failure")
.map((x) => x)}</div>
Here your codesandbox modified.