React Fundamentals

Think in components: JSX, props, rendering lists, conditional UI and composing small pieces into full pages.

Intermediate · about 10 hours · difficulty 2/5

Learn first: TypeScript Fundamentals, Flexbox, Grid and Responsive Design

React describes the UI as a function of data. You change the data; React updates the screen. Next.js, which you will learn next, is built on these same ideas.

Components and JSX

A component is a function that returns JSX. JSX looks like HTML but is JavaScript: use className instead of class, wrap expressions in curly braces, and return a single root element (or a fragment).

Props

Props pass data down from parent to child. Treat them as read-only. Use children to build layout components like Card or Modal that wrap other content.

Rendering lists and conditions

  • map over arrays to render lists, and give every item a stable key (an id, not the array index when items can reorder).
  • Use && or a ternary for conditional UI, and early returns for loading and error states.

Thinking in React

Break a design into a component tree, decide which component owns each piece of data, and pass it down. Keep components small and focused; if a file is 400 lines, split it.

Pitfalls

  • Using array index as key in lists that can be sorted or filtered.
  • Copying props into state, which then goes stale.
  • One giant App component that does everything.

You are ready to move on when you can turn a static mockup of an internship board into a component tree with typed props and render it from an array of data.

Key concepts

  • Components and JSX
  • Props and children
  • Rendering lists with keys
  • Conditional rendering
  • Component composition
  • Thinking in React
  • React DevTools

Mini project

Build a Vite + React + TypeScript internship board from a local JSON array: a list of cards, a details panel, and empty, loading and error states, split into at least six components.

Check yourself

Why does React need a key on list items, and what goes wrong if you use the array index on a sortable list?

Free resources