React.
js Frontend Developer Cheat Sheet
1. Core Concepts:
- Virtual DOM: In-memory representation of the UI; diffed and patched efficiently.
- Components: Reusable UI pieces. Functional (with Hooks) vs Class (with lifecycle methods).
- JSX: Syntax extension to write HTML in JavaScript.
- Props vs State: Props are read-only, state is local and mutable.
2. Hooks:
- useState: State in functional components.
- useEffect: Side-effects like fetching data.
- useContext: Access global context values.
- useMemo, useCallback: Performance optimization.
3. Lifecycle (Class):
- Mounting: constructor -> render -> componentDidMount
- Updating: shouldComponentUpdate -> render -> componentDidUpdate
- Unmounting: componentWillUnmount
4. Advanced:
- Controlled vs Uncontrolled Components
- HOC (Higher Order Components)
- Context API: Global state management
- React Router: Client-side routing
- Redux: Centralized state management
5. Performance:
- Memoization: React.memo, useMemo, useCallback
- Lazy Loading: React.lazy, Suspense
- Code Splitting: Webpack
6. Styling:
- CSS, CSS Modules, Styled-components, Tailwind
- CSS-in-JS: Scoped and dynamic styling
7. Testing:
- Jest, React Testing Library
8. Tools:
- Babel: Transpiler for JSX
- Webpack: Bundler
- DevTools: Debugging
9. Real-World:
- Authentication: JWT + Protected Routes
- API Calls: axios/fetch with useEffect
- Forms: Controlled inputs, Formik/Yup
10. Tips:
- Always use keys in lists
- Lift state for shared data
- Use environment variables for config