Let's take another example. let's say we want to render the users based on their privileges.

const isofferEligibleForUser = (offer) => {

// some logic

}

return <>

{ isofferEligibleForUser(1) && <Offer1 /> }

{ isofferEligibleForUser(2) && <Offer2 /> }

{ isofferEligibleForUser(3) && <Offer1 />

</>

Will you consider this a better example of my point? Or will you still prefer if-else.

If not why?

Software Engineer | https://www.mohammadfaisal.dev/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store