| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| while (stack.length) { | ||
| let child = stack.pop(); | ||
| if (child) { | ||
| if (child !== undefined && child !== null) { |
There was a problem hiding this comment.
This would allow <div>{true}</div> to render <div>true</div>. Do we want that? The VDOM libs ignore booleans.
In any case, this statement can compress to:
| if (child !== undefined && child !== null) { | |
| if (child != null) { |
Sorry, something went wrong.
There was a problem hiding this comment.
It also allowed it before so we could leave as is or correct it, up to you. The shorter version while shorter is not explicit, it's better to always use the === and !== operators. Just my thoughts.
Sorry, something went wrong.
There was a problem hiding this comment.
I would concur with @dburles that being more explicit is often clearer. Also on the <div>{true}</div> debate mimicking the behaviour of React/Preact etc. seems intuitive.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Passing in number 0 as a child would result in nothing being rendered. See test:
https://github.com/dburles/vhtml/blob/88278a1fb47f93edb40e974ab4eaf6923169f4a4/test/vhtml.js#L169-L178