
react
Quiz
•
Science, Professional Development, Computers
•
University
•
Practice Problem
•
Hard
Nghia Ngoc
Used 10+ times
FREE Resource
Enhance your content in a minute
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
10 sec • 5 pts
What is the second argument for setState useful for?
To invoke code after the setState operation is done
To replace the state completely instead of the default merge action
To access the previous state before the setState operation
None of the above
2.
MULTIPLE CHOICE QUESTION
10 sec • 5 pts
How do you invoke setDone only when component mounts, using hooks?
useEffect(() => { setDone(true);
});
useEffect(() => { setDone(true);
}, []);
useEffect(() => { setDone(true);
}, [setDone]);
useEffect(() => { setDone(true);
}, [done, setDone]);
3.
MULTIPLE CHOICE QUESTION
10 sec • 5 pts
Which Hook could be used to update the document's title?
useEffect(function updateTitle() { document.title = name + ' ' + lastname; });
useEffect(() => { title = name + ' ' + lastname;
});
useEffect(function updateTitle() { name + ' ' + lastname;
});
useEffect(function updateTitle() {
title = name + ' ' + lastname;
});
4.
MULTIPLE CHOICE QUESTION
5 sec • 5 pts
Will useEffect affect other data?
True
False
5.
MULTIPLE CHOICE QUESTION
20 sec • 5 pts
If a function component should always render the same way given the same props, what is a simple performance optimization available for it?
Wrap it in the React.memo higher-order component.
Implement the useReducer Hook.
Implement the shouldComponentUpdate lifecycle method.
Implement the useMemo Hook.
6.
MULTIPLE CHOICE QUESTION
10 sec • 5 pts
When do you use useLayoutEffect?
to optimize for all devices
to complete the update
to change the layout of the screen
when you need the browser to paint after the effect runs
7.
MULTIPLE CHOICE QUESTION
10 sec • 5 pts
Why might you use useReducer over useState in a React component?
when you have complex state logic that involves multiple sub-values
when you want to break your production app
when you like =)))
can not be replaced
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
10 questions
TOPIC 1 COMPUTER NETWORK
Quiz
•
University
10 questions
Energy and Environment
Quiz
•
University
10 questions
AGR232: Chapter 9 Cocoa
Quiz
•
University
10 questions
PLANNING AND PREPARING FOR MAINTAINANCE
Quiz
•
University
13 questions
CIS2303 Week_3 CLO2
Quiz
•
University
10 questions
Introduction to Mobile Commerce
Quiz
•
University
10 questions
Cell Structure and Function Pre-Test
Quiz
•
8th Grade - University
13 questions
6th Grade Camp
Quiz
•
6th Grade - University
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
