I am having this code.
{
Object.keys(_.get(order, "customer", {})).map((key) => {
if (key !== "defaultOption" && customer[key] !== "") {
return (
<option key={key} value={key}>
{_.startCase(key)}
</option>
);
}
});
}
And having below warning
Line 885:96: Expected to return a value at the end of arrow function array-callback-return
I know because I am using if statement inside the map function. So, How to get rid of the error?
return something after the if statement (even if it is an empty string).
You might want to filter such values out of the array afterwards (or just filter the array first instead of using an if).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With