fac25 / amai-mtoto

amai-mtoto.vercel.app
1 stars 1 forks source link

conditional rendering #109

Closed jackherizsmith closed 1 year ago

jackherizsmith commented 1 year ago

I love your use of <Layout/>! It's great.

Something I've found helpful managing conditional logic (i.e. if (true) { do thing }), is that it's easier to write, read and understand if you make the conditional variable truthy. I hope that makes sense, but as an example:

{!user ? null : <BabyProgress/>}

becomes

{user ? <BabyProgress/> : null}

and actually in this instance you can use a literally true or false variable to render just the thing you need:

{!!user && <BabyProgress/>}

but this would just be up to your preferences.