React Quick Start Notes: A Beginner-Friendly Tutorial
This tutorial turns the React "Quick Start" material into a compact reference for JavaScript learners who want a beginner-friendly path.
1) Components and JSX
A component is a JavaScript function that returns JSX. JSX is a syntax extension that looks like HTML but compiles to JavaScript.
2) Props
Props are inputs to components. They flow from parent to child.
3) State
State is component-local data that changes over time.
function Counter() {
const [count, setCount] = React.useState(0)
return <button onClick={() => setCount(count + 1)}>{count}</button>
}
4) Lists and Keys
Use map to render lists and provide stable keys.
function List({ items }) {
return (
<ul>
{items.map((item) => (
<li key={item.id}>{item.title}</li>
))}
</ul>
)
}
5) Conditional Rendering
Render different UI based on conditions.
6) Quick Checklist
- Components are functions.
- Props flow down.
- State changes over time.
- Keys must be stable and unique.