Sometimes, we don’t want to render HTML in our React component.
In this article, we’ll look at which values React components can render other than HTML.
Is it Possible to Have React Components that Doesn’t Render HTML?
It’s possible to render values other than HTML in a component.
We can render one of the following values if we don’t a React component to render anything:
false
null
[]
<React.Fragment></React.Fragment>
<></>
We can render false
, null
, an empty array or an empty fragment in our component.
However, we can’t render undefined
.
Conclusion.
It’s possible to render values other than HTML in a component.
We can render false
, null
, an empty array or an empty fragment in our component.
However, we can’t render undefined
.