I'm learning react and I came across the next expression
ReactDOM.render(true && 123 && <functionThatReturnBool> && "foo")
I tried to research a bit, didn't find too many sources, so I played with the code a little bit, and this is what I came up with:
- if something is
false/null/Nal/undefined/""/0
then it will return this value and won't continue to the next expression (as expected) - if everything is true it will return the last value
- React doesn't render
bool
just like he doesn't render null, undefined etc. Since that, In case something is false nothing will render, unless something is 0.
Is there any sources that explain this expression?
I missed/wrong at something?
Aucun commentaire:
Enregistrer un commentaire