i want this to be mapping instead of hard coding the cases
const wCategory = () => {
switch (categoryhovered) {
case 1:
return <SalePriceCtg />
case 2:
return <ArticlesCtg />
default:
return <div>smth3</div>
}
}
i cant map the cases so im searching for a better way to do it
2
Answers
Here is a way to use an object instead of a switch statement:
You can use an object to map the cases instead of hardcoding them with a switch statement