
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
Scratch Quiz
Quiz
•
KG - Professional Dev...
20 questions
PRODUKTIF TKJ LATIHAN TRY OUT
Quiz
•
1st - 10th Grade
19 questions
Heath and Safety In Animal Care
Quiz
•
8th Grade - Professio...
20 questions
FOOD TECH - END OF TERM QUIZ 1
Quiz
•
7th - 10th Grade
18 questions
Evaluare ”Domnia legii și puterea cetățenilor”
Quiz
•
6th - 7th Grade
20 questions
PBIS-REMS
Quiz
•
6th - 8th Grade
20 questions
Eating Area Quiz
Quiz
•
5th - 7th Grade
20 questions
Intro to Mixed Media
Quiz
•
6th - 8th 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
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th 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
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
23 questions
Academic Vocabulary Pre-assessmsent
Quiz
•
6th Grade
22 questions
distributive property
Quiz
•
7th Grade
18 questions
Angle Relationships
Quiz
•
7th Grade
15 questions
Distributive Property & Review
Quiz
•
6th Grade
10 questions
Understanding Poetry and Literary Devices
Interactive video
•
4th - 8th Grade
