Mohammad Faisal
Apr 25, 2021

--

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?

--

--