A boolean written in JSX shows nothing on the page
Your error
<p>Admin: {isAdmin}</p> shows only the label, with no true or false after it2 more lines it can showFix it fast
Most common cause, 1 of 2A boolean is placed directly in the JSX
Decide what the reader should see and build that text yourself.
<p>Admin: {isAdmin ? 'Yes' : 'No'}</p>
<p>Active: {String(isActive)}</p>Short answer
A boolean in JSX such as {isAdmin} shows nothing because React 19 treats true, false, null and undefined as empty nodes. Turn the value into text yourself with a ternary or String(isAdmin). The opposite trap is a count of 0 on the left of &&: a number, not a boolean, so React prints the 0.
Which cause do you have?
Show the real values and their types on the page, next to the place that renders wrongly. JSON.stringify keeps true, 0 and the string "true" visibly different.
<pre>{JSON.stringify({ isAdmin, count })}</pre>Then find the line you see in this list and open its fix:
What does the error look like?
<p>Admin: {isAdmin}</p> shows only the label, with no true or false after itA block that should be hidden shows a lone 0 insteadStrings and numbers inside braces appear on the page, true and false never do
Cause 1 of 2
A boolean is placed directly in the JSX
You seeThe JSON output shows true or false, and the screen shows nothing at that spot
Check
A boolean placed straight into JSX renders nothing because React counts it as an empty node. React's docs list null, undefined and booleans that way among the valid values for children. They are accepted as content and they draw nothing, so {isAdmin} is not a bug in React but a value with no visible form.
grep -rn -E "\{(is|has|can|should)[A-Za-z]*\}" srcFix
Decide what the reader should see and build that text yourself. A ternary picks one of two strings, and String() prints the word.
<p>Admin: {isAdmin ? 'Yes' : 'No'}</p>
<p>Active: {String(isActive)}</p>Verify
Reload the page and check that the text now follows the value.
npm run devConfirmed by react.dev
Cause 2 of 2
A number sits on the left of &&
You seeA stray 0 appears exactly when the list or counter is empty
Check
A stray 0 on the page comes from a number on the left of &&, which React renders like any other number. The expression count && <Badge /> returns the left side when it is falsy. With a count of 0 that value is the number 0. With a real false, React leaves a hole in the tree and renders nothing.
grep -rn -E "\.length &&|[Cc]ount &&" srcFix
Make the left side a boolean with a comparison, or use a ternary that returns null for the empty case.
{items.length > 0 && <List items={items} />}
{items.length ? <List items={items} /> : null}Verify
Load the page with an empty list. Nothing appears where the 0 used to be.
npm run devConfirmed by react.dev
How do I stop it coming back?
- Write conditions as comparisons (items.length > 0, count !== 0) so the left side of && is always a true boolean.
- Keep one small helper for yes/no text instead of repeating ternaries across components.
- When a flag has to be visible while debugging, print it with JSON.stringify rather than relying on JSX to show it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, QistLock, Taskvare.