[React] <></> vs <React.Fragment></React.Fragment>
Closed this issue · 1 comments
phuocng commented
[React] <>> vs
saharshg commented
<></>:
- It lets you wrap multiple children together in a single react node when you don't want to wrap your children unnecessarily with any extra div/span.
- No props are accepted.
<React.Fragment></React.Fragment>:
- Used same as <></> except "key" prop is accepted.
- Mostly used as a wrapper for an element inside a loop(map).