What is meant by {" "}
in React JSX? I see it in the code below:
<p><a href="/" className="mx-1">Home</a> {" "}| {" "} <a className="mx-1" href="/about-us">About
Us</a> {" "}|{" "}<a className="mx-1" href="/terms">Terms</a></p>
What is meant by {" "}
in React JSX? I see it in the code below:
<p><a href="/" className="mx-1">Home</a> {" "}| {" "} <a className="mx-1" href="/about-us">About
Us</a> {" "}|{" "}<a className="mx-1" href="/terms">Terms</a></p>
{}
is used to interpolate JavaScript inside your JSX.
Using {' '}
is used to insert a space inside your JSX while avoiding any side effet. Using this to insert a space does not insert any HTML tag in your code.
When you want to add JavaScript inside your JSX, you need to use {}
To add a space {' '}
can be used. But generally, the prettier converts some spaces in the editor into {' '}
.