React.
js One-Week Learning Cheat Sheet
Day 1 - Fundamentals & Setup
- React: JavaScript library for building UIs
- SPA: Single Page Application
- JSX: Syntax extension for writing HTML in JS
- Virtual DOM improves performance
Setup:
1. Install Node.js and npm
2. npx create-react-app my-app
3. npm start
Day 2 - Components & Props
- Function components preferred over Class
- Props pass data into components
- JSX rules: one parent element, use {} for JS
Example: <UserCard name='John' age={25} />
Day 3 - State & Events
- useState hook for local state
- Event handling: onClick, onChange, etc.
- Controlled components for inputs
Example: const [count, setCount] = useState(0)
Day 4 - Lists & Conditionals
- Use map() to render lists
- Keys help React identify list items
- Conditional rendering with ternary or &&
Day 5 - useEffect & Data Fetching
- useEffect handles side effects
- Fetch data inside useEffect
Example:
useEffect(() => {
fetch(url).then(res => res.json()).then(data => setData(data))
}, [])
Day 6 - Styling & Structure
- CSS Modules: styleName.module.css
- Tailwind CSS for utility-first styling
- Keep components in /components folder
Day 7 - Mini Project & Deployment
- Project ideas: Weather App, Recipe Finder, Blog
- Deploy with Vercel or Netlify
- Push code to GitHub first