How to add React Components that Doesn’t Render HTML with JavaScript?

Sometimes, we don’t want to render HTML in our React component with JavaScript.

In this article, we’ll look at which values React components can render other than HTML with JavaScript.

How to add React Components that Doesn’t Render HTML with JavaScript?

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.