React Introduction - What is React?
Understanding React and component-based architecture
Beginner⏱️ 20 minutes
Lesson Content
Welcome to React!
React is a JavaScript library for building user interfaces using components.
Why React?
- Component-Based: Build encapsulated components that manage their own state
- Declarative: Design simple views for each state in your application
- Learn Once, Write Anywhere: Create web apps, mobile apps, and more
Your First Component:
function Welcome() {
return <h1>Hello, React!</h1>
}
JSX (JavaScript XML):
JSX lets you write HTML-like code in JavaScript:
const element = <h1>Hello, World!</h1>
const name = "Alice"
const greeting = <h1>Hello, {name}!</h1>
Key Concepts:
- Components are JavaScript functions that return JSX
- JSX expressions go inside curly braces {}
- Components can be reused throughout your app
Task: Create your first React component.
javascript
Loading...
Expected Output: Welcome