Skip to main content
InterviewHubPRO
Section Overview
Q206

Question 206 of 407

Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

51%
React Core & Hooks (407 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

How do you print falsy values in JSX?

mid LevelCode ExampleFormsPerformance

The falsy values such as false, null, undefined, and true are valid children but they don't render anything. If you still want to display them then you need to convert it to string. Let's take an example on how to convert to a string,

javascript
<div>My JavaScript variable is {String(myVariable)}.</div>