I'm trying to understand when to use <>
and when to use <div>
when writing React JS code.
The formatting is different when I switch between them but I'm not sure why.
I'm trying to understand when to use <>
and when to use <div>
when writing React JS code.
The formatting is different when I switch between them but I'm not sure why.
<>Hello</>
is a JSX Element which renders to html text Hello
.
<div>Hello</div>
is a JSX Element containing a div that renders as <div>Hello</div>
.