Skip to content
Learn Netverks

Lesson

Step 8/36 22% through track

components-functions

Function components

Last reviewed May 28, 2026 Content v20260528
Track mode
client_react
Means
In-browser React TSX
Reading
~1 min
Level
beginner

This lesson

This lesson teaches Function components: the concepts, APIs, and habits you need before advancing in React.

Without Function components, you will struggle to read or extend React codebases and playground exercises.

You will apply Function components in contexts like: SPAs, dashboards, design-system-driven products, and React Native mobile apps.

Write TypeScript/TSX, click Run in browser—React 18 loads from CDN, JSX compiles in the tab, UI renders in the preview root, and printOutput feeds the terminal.

When you can explain the previous lesson's ideas without copying starter code.

Modern React favors function components: plain functions that accept props and return JSX. They replace the older class component style for most new code.

Naming and structure

  • Component names use PascalCase: UserCard, not userCard.
  • Keep components focused—one clear responsibility per file in real projects.
  • Extract repeated JSX into smaller components instead of copy-pasting markup.

Composition over inheritance

React rarely uses class inheritance for UI. You compose behavior by nesting components and passing props—similar to building UI from Bootstrap cards and buttons, but in TypeScript functions.

Important interview questions and answers

  1. Q: Function vs class components?
    A: Functions with hooks are standard; classes remain in legacy codebases but are not the default for new features.
  2. Q: Where does side-effect code go in function components?
    A: In useEffect or event handlers—not directly in the render body.

Self-check

  1. Why must component names start with a capital letter?
  2. What should a function component return?

Challenge

Card component

  1. Extract a Card component with title and body props.
  2. Render two Card instances from App.

Done when: two cards appear with different titles in the preview.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Split component how?
  • Naming convention?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump