
React Day 03
Quiz
•
Other
•
6th - 8th Grade
•
Practice Problem
•
Easy
Gnanavel Durairaj
Used 1+ times
FREE Resource
Enhance your content in a minute
22 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can we update state based on the previous state?
setState(count + 1);
setState((prev) => prev + 1);
setState(() => count + 1);
setState = count + 1;
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When does useEffect run if the dependency array is empty ([])?
Every render
Only once after the initial render
When the component is unmountedNever
Never
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen in this code?
useEffect(() => {
console.log("Effect ran!");
}, []);
Logs "Effect ran!" on every render
Logs "Effect ran!" once after mounting
Throws an error
Does not execute
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you clean up effects in useEffect?
useEffect(() => {
const interval = setInterval(() => {
console.log("Hello");
}, 1000);
return () => clearInterval(interval);
}, []);
useCleanup()
Using return () => {} inside useEffect
componentWillUnmount()
No cleanup needed
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main purpose of useContext?
To create state in a component
To fetch data from an API
To manage global state without prop drilling
To handle lifecycle methods
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to consume context inside a component?
const MyContext = createContext("default");
const value = ???
useContext(MyContext);
<MyContext.Consumer>
MyContext.Provider
useState(MyContext);
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is required when using useContext?
A state variable
A reducer
A provider component
Nothing, it works standalone
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
Engineering and Design
Quiz
•
7th Grade
20 questions
Chapter 3 - Stress
Quiz
•
7th Grade
21 questions
PowerPoint Review
Quiz
•
6th - 8th Grade
20 questions
MUSIC OF MINDORO, PALAWAN, AND THE VISAYAS
Quiz
•
7th Grade
20 questions
TAH Yr7 AW2 Food
Quiz
•
7th Grade
17 questions
Pio XII - Rules and Norms
Quiz
•
6th - 9th Grade
20 questions
vehicle maintenance & vehicle engine (b)
Quiz
•
1st Grade - University
20 questions
Factors Effecting Food Choices
Quiz
•
7th - 9th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Other
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
10 questions
Groundhog Day Trivia Questions
Interactive video
•
3rd - 6th Grade
20 questions
Exponents
Quiz
•
6th Grade
5 questions
Legends, Leaders, & Changemakers: Maya Angelou
Interactive video
•
6th - 8th Grade
22 questions
distributive property
Quiz
•
7th Grade
15 questions
Distributive Property & Review
Quiz
•
6th Grade
10 questions
Figurative Language
Quiz
•
6th Grade
