when doing conditional rendering, if we do such thing:
<p>{NaN && <div>Hello</div>}</p>
it will evaluate to NaN
and will render it on screen. but in React document itself, NaN
is not mentioned.
A React node can be:
- A React element created like
<div />
orcreateElement('div')
- A portal created with
createPortal
- A string
- A number
- true, false, null, or undefined (which are not displayed)
- An array of other React nodes
I confused about it.
https://react.dev/reference/react/isValidElement#isvalidelement