Categories
JavaScript Answers

How to render empty space in React and JavaScript?

Spread the love

Sometimes, we want to render empty space in React and JavaScript.

In this article, we’ll look at how to render empty space in React and JavaScript.

How to render empty space in React and JavaScript?

To render empty space in React and JavaScript, we can put the character code for spaces into the code.

For instance, we write:

import React from "react";

export default function App() {
  return <>foo{"\u00a0\u00a0"}bar</>;
}

to add "\u00a0\u00a0" to add 2 spaces between foo and bar.

Conclusion

To render empty space in React and JavaScript, we can put the character code for spaces into the code.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *