React Fundamentals
150 exercises
Practice exercises for react fundamentals.
- 1
What Is React?
Test your understanding of what React is and its core characteristics.
Multiple Choice Beginner - 2
JSX className vs class
Quiz on the correct way to apply CSS classes in JSX.
Multiple Choice Easy - 3
Component Naming Convention
Test your knowledge of React component naming conventions.
Multiple Choice Easy - 4
Props Are Read-Only
Quiz on the immutability of props in React components.
Multiple Choice Easy - 5
useState Return Value
Test what useState returns when called.
Multiple Choice Easy - 6
React Event Naming
Quiz on how React names event handler props.
Multiple Choice Easy - 7
Conditional Rendering with &&
Test understanding of the logical && rendering pattern.
Multiple Choice Medium - 8
List Key Best Practice
Quiz on the best practice for choosing keys in lists.
Multiple Choice Easy - 9
useEffect with Empty Deps
Test when useEffect runs with an empty dependency array.
Multiple Choice Medium - 10
Context Purpose
Quiz on what problem Context solves in React.
Multiple Choice Medium - 11
useReducer vs useState
Test when to prefer useReducer over useState.
Multiple Choice Medium - 12
useRef Does Not Re-render
Quiz on useRef behavior when the .current value changes.
Multiple Choice Medium - 13
Custom Hook Naming
Test the naming convention requirement for custom Hooks.
Multiple Choice Easy - 14
Fragment Purpose
Quiz on why Fragments exist in React.
Multiple Choice Easy - 15
useMemo Purpose
Test understanding of when useMemo is useful.
Multiple Choice Medium - 16
React.lazy and Suspense
Quiz on lazy loading components in React.
Multiple Choice Medium - 17
Error Boundary Limitation
Test what error boundaries can and cannot catch.
Multiple Choice Medium - 18
Controlled Input
Quiz on what makes an input 'controlled' in React.
Multiple Choice Easy - 19
React Router Link
Test knowledge of React Router navigation.
Multiple Choice Easy - 20
Rules of Hooks
Quiz on the Rules of Hooks in React.
Multiple Choice Medium - 21
Predict JSX Expression Output
Predict what JSX renders when embedding a JavaScript expression.
Predict Output Beginner - 22
Predict Props Rendering
Predict the output of a component receiving props.
Predict Output Easy - 23
Predict State After Updates
Predict the state value after multiple setState calls.
Predict Output Medium - 24
Predict Ternary Rendering
Predict what a ternary operator renders in JSX.
Predict Output Easy - 25
Predict List Rendering
Predict the DOM output of a mapped list.
Predict Output Easy - 26
Predict Event Handler Result
Predict what happens when a button is clicked.
Predict Output Easy - 27
Predict useEffect Execution
Predict how many times an effect runs.
Predict Output Medium - 28
Predict Reducer State
Predict the state after dispatching actions to a reducer.
Predict Output Medium - 29
Predict Ref Value
Predict what a ref holds after rendering.
Predict Output Medium - 30
Predict && Rendering
Predict what the && operator renders when the condition is true.
Predict Output Easy - 31
Predict Component Composition
Predict the rendered output of composed components.
Predict Output Easy - 32
Predict Object State Update
Predict the state after updating an object with spread.
Predict Output Medium - 33
Predict Filtered List
Predict which items render after filtering.
Predict Output Medium - 34
Predict Controlled Input Value
Predict the input value after state changes.
Predict Output Easy - 35
Predict Context Value
Predict what a context consumer renders.
Predict Output Medium - 36
Predict Fragment Output
Predict the DOM structure when using Fragments.
Predict Output Easy - 37
Predict useMemo Recomputation
Predict whether useMemo recomputes on a given render.
Predict Output Medium - 38
Predict preventDefault Behavior
Predict what happens when a form is submitted.
Predict Output Medium - 39
Predict Default Prop Value
Predict the rendered output when a prop has a default value.
Predict Output Easy - 40
Predict Array State Update
Predict the array state after adding an item.
Predict Output Medium - 41
Complete a Function Component
Fill in the blank to complete a basic React function component.
Fill in the Blank Beginner - 42
Complete useState Declaration
Fill in the blank to correctly declare state with useState.
Fill in the Blank Easy - 43
Complete Props Destructuring
Fill in the blank to destructure the name prop.
Fill in the Blank Easy - 44
Complete onClick Handler
Fill in the blank to create a click handler.
Fill in the Blank Easy - 45
Complete useEffect Dependency Array
Fill in the blank to run the effect only on mount.
Fill in the Blank Medium - 46
Complete List Rendering with map
Fill in the blank to render a list of items.
Fill in the Blank Easy - 47
Complete Conditional Rendering
Fill in the blank to conditionally render a message.
Fill in the Blank Easy - 48
Complete useContext Call
Fill in the blank to read a Context value.
Fill in the Blank Medium - 49
Complete useRef Declaration
Fill in the blank to create a ref initialized to null.
Fill in the Blank Easy - 50
Complete Fragment Syntax
Fill in the blank to use the Fragment shorthand.
Fill in the Blank Easy - 51
Complete Controlled Input
Fill in the blank to make a controlled input.
Fill in the Blank Easy - 52
Complete State Update with Spread
Fill in the blank to update an object property immutably.
Fill in the Blank Medium - 53
Complete useReducer Dispatch
Fill in the blank to dispatch an action.
Fill in the Blank Medium - 54
Complete useMemo Call
Fill in the blank to memoize an expensive calculation.
Fill in the Blank Medium - 55
Complete React Router Route
Fill in the blank to define a route path.
Fill in the Blank Easy - 56
Complete React.lazy Import
Fill in the blank to lazily load a component.
Fill in the Blank Medium - 57
Complete Custom Hook Name
Fill in the blank with a valid custom Hook name.
Fill in the Blank Easy - 58
Complete Portal Creation
Fill in the blank to create a portal for a modal.
Fill in the Blank Medium - 59
Complete Error Boundary Method
Fill in the blank to catch errors in an error boundary.
Fill in the Blank Medium - 60
Complete useEffect Cleanup
Fill in the blank to return a cleanup function.
Fill in the Blank Medium - 61
Find: Missing Return Statement
Find the mistake in this component definition.
Find the Mistake Beginner - 62
Find: Direct State Mutation
Find the mistake in this state update.
Find the Mistake Medium - 63
Find: Missing Key Prop
Find the mistake in this list rendering.
Find the Mistake Easy - 64
Find: Conditional Hook Call
Find the mistake that violates the Rules of Hooks.
Find the Mistake Medium - 65
Find: Multiple Root Elements
Find the mistake in this component's return.
Find the Mistake Easy - 66
Find: Missing Dependency
Find the mistake in this useEffect.
Find the Mistake Medium - 67
Find: Missing preventDefault
Find the mistake in this form submission.
Find the Mistake Easy - 68
Find: Uncontrolled to Controlled Switch
Find the mistake with this input's value.
Find the Mistake Medium - 69
Find: Missing Cleanup Function
Find the mistake in this useEffect with a timer.
Find the Mistake Medium - 70
Find: Modifying Props
Find the mistake in this component.
Find the Mistake Easy - 71
Find: setState During Render
Find the mistake causing an infinite loop.
Find the Mistake Medium - 72
Find: Index as Key
Find the mistake in this list rendering.
Find the Mistake Medium - 73
Find: && with Zero
Find the mistake in this conditional rendering.
Find the Mistake Medium - 74
Find: Missing Provider
Find the mistake in this Context usage.
Find the Mistake Medium - 75
Find: Object in Dependency Array
Find the mistake causing an infinite loop.
Find the Mistake Medium - 76
Find: Lowercase Component Name
Find the mistake in this component usage.
Find the Mistake Easy - 77
Find: Stale Closure in setInterval
Find the mistake in this timer.
Find the Mistake Medium - 78
Find: class Instead of className
Find the mistake in this JSX.
Find the Mistake Easy - 79
Find: Missing Default Case in Reducer
Find the mistake in this reducer.
Find the Mistake Medium - 80
Find: Missing Catch-All Route
Find the mistake in this route configuration.
Find the Mistake Easy - 81
Declarative vs Imperative
Check your understanding of React's declarative paradigm.
Concept Check Medium - 82
Component Reusability
Check understanding of why components are reusable.
Concept Check Easy - 83
State as Component Memory
Check understanding of what state represents.
Concept Check Easy - 84
Unidirectional Data Flow
Check understanding of data flow direction in React.
Concept Check Medium - 85
Side Effects in useEffect
Check understanding of what belongs in useEffect.
Concept Check Medium - 86
When to Use Context
Check understanding of appropriate Context use cases.
Concept Check Medium - 87
When to Use useMemo
Check understanding of appropriate useMemo usage.
Concept Check Medium - 88
Lifecycle Phases
Check understanding of the three lifecycle phases.
Concept Check Easy - 89
Controlled vs Uncontrolled
Check understanding of controlled vs uncontrolled inputs.
Concept Check Medium - 90
Custom Hook Purpose
Check understanding of why custom Hooks are useful.
Concept Check Medium - 91
Code Splitting Benefit
Check understanding of why lazy loading is beneficial.
Concept Check Medium - 92
Error Boundary Placement
Check understanding of where to place error boundaries.
Concept Check Medium - 93
Portal Use Case
Check understanding of when to use portals.
Concept Check Medium - 94
Fragment vs Div
Check understanding of when to prefer Fragments over divs.
Concept Check Easy - 95
Ref vs State
Check understanding of when to use a ref vs state.
Concept Check Medium - 96
SPA Navigation
Check understanding of how React Router enables SPA navigation.
Concept Check Easy - 97
Unnecessary Re-renders
Check understanding of what causes unnecessary re-renders.
Concept Check Medium - 98
TypeScript with React
Check understanding of TypeScript benefits in React.
Concept Check Medium - 99
Data Fetching in useEffect
Check understanding of data fetching patterns.
Concept Check Medium - 100
Lifting State Up
Check understanding of the 'lifting state up' pattern.
Concept Check Medium - 101
React Component Type
What is a React functional component?
Multiple Choice Beginner - 102
JSX Expression
What is JSX?
Multiple Choice Beginner - 103
Props Immutability
Can a component modify its own props?
Multiple Choice Beginner - 104
useState Hook
What does useState return?
Multiple Choice Beginner - 105
useEffect Dependencies
What does the dependency array in useEffect do?
Multiple Choice Easy - 106
useRef Purpose
What is useRef primarily used for?
Multiple Choice Easy - 107
useContext Purpose
What does useContext do?
Multiple Choice Easy - 108
useReducer vs useState
When should you prefer useReducer over useState?
Multiple Choice Medium - 109
Key Prop Purpose
Why does React need the key prop in lists?
Multiple Choice Easy - 110
Conditional Rendering
How do you conditionally render a component in React?
Multiple Choice Beginner - 111
Event Handler Naming
What is the conventional name for a click event handler?
Multiple Choice Beginner - 112
Controlled Input
What is a controlled component in React forms?
Multiple Choice Easy - 113
useEffect Cleanup
When does the cleanup function in useEffect run?
Multiple Choice Medium - 114
Fragment Purpose
Why use React Fragments?
Multiple Choice Easy - 115
Memoization useMemo
What does useMemo do?
Multiple Choice Medium - 116
React.memo Purpose
What does React.memo do?
Multiple Choice Medium - 117
useCallback Purpose
What does useCallback do and when to use it?
Multiple Choice Medium - 118
Context Provider
How do you provide a context value to child components?
Multiple Choice Easy - 119
Error Boundary
What is an error boundary in React?
Multiple Choice Medium - 120
Lazy Loading
What does React.lazy do?
Multiple Choice Medium - 121
Portal Purpose
What do React Portals do?
Multiple Choice Medium - 122
Custom Hook Rules
What are the rules of custom hooks?
Multiple Choice Easy - 123
Render Props Pattern
What is the render props pattern?
Multiple Choice Medium - 124
Strict Mode
What does React.StrictMode do?
Multiple Choice Easy - 125
Synthetic Events
What are React synthetic events?
Multiple Choice Medium - 126
Component Re-render
What triggers a React component to re-render?
Multiple Choice Easy - 127
Prop Drilling
What is prop drilling and how to avoid it?
Multiple Choice Easy - 128
useEffect vs useLayoutEffect
How does useLayoutEffect differ from useEffect?
Multiple Choice Medium - 129
React Router NavLink
What does NavLink do in React Router?
Multiple Choice Easy - 130
React Router Params
How do you access URL parameters in React Router?
Multiple Choice Easy - 131
JSX Render Output
Predict the output.
Predict Output Beginner - 132
useState Initial
Predict the output.
Predict Output Beginner - 133
useState Updater
Predict the output.
Predict Output Easy - 134
Props Passing
Predict the output.
Predict Output Beginner - 135
Conditional && Render
Predict the output.
Predict Output Beginner - 136
Ternary Render
Predict the output.
Predict Output Easy - 137
List Map Render
Predict the output.
Predict Output Easy - 138
useEffect No Deps
Predict the output.
Predict Output Easy - 139
useEffect Empty Deps
Predict the output.
Predict Output Easy - 140
useRef Value
Predict the output.
Predict Output Easy - 141
Object Props Spread
Predict the output.
Predict Output Easy - 142
Fragment Children
Predict the output.
Predict Output Easy - 143
useMemo Cache
Predict the output.
Predict Output Medium - 144
Context Consumer
Predict the output.
Predict Output Medium - 145
useReducer Dispatch
Predict the output.
Predict Output Medium - 146
Event Prevent Default
Predict the output.
Predict Output Easy - 147
Derived State
Predict the output.
Predict Output Easy - 148
Callback Identity
Predict the output.
Predict Output Medium - 149
useEffect Cleanup Order
Predict the output.
Predict Output Medium - 150
State Batch Update
Predict the output.
Predict Output Medium
Build real projects
Apply what you learned by building guided projects with starter code and solutions.