What is React?
Understanding React's core philosophy and component model
- Course
- React fundamentals
- Lesson
- 1 of 9
- Level
- Beginner
- Reading time
- 10 minutes
Introduction to React ¶
React is a powerful JavaScript library for building user interfaces, particularly single-page applications. It was developed by Facebook (now Meta) and has become one of the most popular frontend frameworks in the world.
Learning objectives
- Understand what React is and why it's popular
- Learn about the component-based architecture
- Grasp the concept of virtual DOM
- Recognize when to use React
What Makes React Special? ¶
Component-Based Architecture ¶
React allows you to build encapsulated components that manage their own state, then compose them to make complex UIs.
function Welcome(props) {
return <h1>Hello, {props.name}</h1>
}
function App() {
return (
<div>
<Welcome name="Alice" />
<Welcome name="Bob" />
<Welcome name="Charlie" />
</div>
)
}Declarative ¶
React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.
Key concept
Virtual DOM ¶
One of React's most powerful features is the Virtual DOM. Instead of manipulating the browser's DOM directly, React creates a virtual representation of it.
When state changes occur, React:
- Creates a new virtual DOM tree
- Compares it with the previous version (diffing)
- Calculates the minimal set of changes needed
- Updates only those parts in the real DOM
This process, called "reconciliation," makes React incredibly efficient.
When to Use React ¶
React is ideal for:
- Single Page Applications (SPAs) - Build fast, interactive web apps
- Complex UIs - Manage state across multiple components
- Reusable Components - Create a component library for consistent UI
- Large Teams - Component-based architecture scales well
Practice exercise
Try to answer these questions:
- What is a component in React?
- How does the Virtual DOM improve performance?
- What does "declarative" mean in the context of React?
Next Steps ¶
Next lesson
Now that you understand what React is, you're ready to set up your development environment and create your first React application!