Frontend with React
📋 Lists and conditional rendering
Render collections with .map() and the key prop, decide what to paint with conditionals, and group elements with fragments.
What you'll learn
- Render lists by transforming an array with
.map()and assigning a unique and stablekey - Show conditional content with the
&&operator, the? :ternary, andreturn null - Group sibling elements without an extra
divusing fragments<>...</> - Choose between
idand index askeydepending on whether the list changes order or size
Lessons
Render lists with .map() and keyTransform arrays into JSX. Conditional renderingPaint (or not) based on a condition. Fragments: group without an extra divReturn several elements without a wrapper.Practice this module in the app
DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.
Start free in the app →