tezvyn:

What is a React Fragment and why use it over a div?

Source: react.devintermediate

This tests JSX semantics and DOM hygiene. A strong answer says Fragments group children without wrapper nodes, preventing extra DOM and invalid HTML like divs in tables. A red flag is citing performance without mentioning DOM structure or semantics.

This tests whether you understand JSX structural constraints and DOM hygiene beyond simple component composition. A strong answer defines a Fragment as a syntax-level grouping that renders no wrapper node, explains that the shorthand is <></> but explicit <Fragment> is required for keys, and gives concrete layout reasons like avoiding invalid HTML when returning multiple table cells or list items from a component. A red flag is claiming Fragments are primarily a performance optimization rather than a DOM structure tool.

Read the original → react.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

What is a React Fragment and why use it over a div? · Tezvyn