Hacker News new | ask | show | jobs
by mcphage 3125 days ago
Why can't they automatically wrap every bit of JSX with a <Fragment> tag? That way users would need to include an empty tag when they're returning multiple elements, and they're not it'll be a fragment tag that just contains a single element.
1 comments

Because you don't know where JSX ends and code begins. Don't forget that fragments can include text nodes too.

return <div />

// am I a comment? Or text after div?

Ah, hmm... good catch.