Intermediate Topic 27 of 51 Web Development
React Fundamentals
Component-based UI library using a virtual DOM.
How it works
React is a JavaScript library for building user interfaces from components, functions that take props and return a description of the UI in JSX. State, managed with hooks such as useState and useReducer, triggers re-rendering when it changes, and React updates the DOM efficiently by diffing a virtual representation. useEffect runs side effects after rendering, and context shares values without prop drilling. Data flows one way, from parent to child.
Step-by-step walkthrough
- UI is built from components, functions returning markup.
- State or props change.
- The component re-renders into a new virtual tree.
- React diffs it against the previous one.
- Only the changed DOM nodes are updated.
Where it is used
Web applications, mobile apps with React Native, design systems and server-rendered sites with frameworks such as Next.js use React.
Common pitfall
Mutating state directly instead of using setters prevents updates. Missing or wrong dependency arrays in useEffect cause stale values or infinite loops. Using array index as key in lists breaks identity when order changes. Heavy renders need memoization and splitting. Keep components small and pure, derive values instead of duplicating state and lift state only as needed.
Where it fits in the course
React Fundamentals is topic 27 of 51 in Web Development, rated Intermediate. It follows Single Page Applications. The next topic is State Management.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Web Development quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Web Development quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is React Fundamentals?
Where do people use React Fundamentals?
What is the most common mistake with React Fundamentals?
What should I learn before this topic?
How can I practice it?
Is React Fundamentals hard to learn?
How long does it take to learn React Fundamentals?
Which topics are related to React Fundamentals?
What should I study after React Fundamentals?
Related topics
- Single Page Applications (Web Development)
- State Management (Web Development)
- ARIA (Web Development)
- Routing in the Browser (Web Development)
- Robotics Fundamentals (Mobile, Embedded & IoT)