React: Use Advanced JavaScript in React Render Method - Ignored Values

I think perhaps it might be worth mentioning in this lesson that values like undefined are ignored by JSX and not rendered. I was considering the case when answer is undefined (the initial render) and was going to add logic to account for it. However, I noticed that simply placing {answer} without adding any logic to account for the undefined case didn’t seem to cause any issues.

With a little digging I found these (apparently older) docs

that says

" false , null , undefined , and true are valid children. They simply don’t render"

which is pretty neat.

Figured it might be worth mentioning, maybe as some sort of Note.

1 Like

I agree, I was facing a similar issue the other day and I learned that “the bad way”, lol. Maybe create a documentation PR?

1 Like

Ah, I’m not familiar with the process for that, will have to look into it. I’ve only ever posted topics on here lol.

the JavaScript curriculum was updated last week, now there is the new beta JavaScript cert, the next one is the frontend cert. But if you have a suggestion on how to change that particular challenge, you can create an issue and/or PR

1 Like