Final graded quiz: Advanced React :Advanced React (Meta Front-End Developer Professional Certificate) Answers 2025
1. Correct Yup validation code
✔️ Yup.string().email(“Invalid email address”).required(“Required”)
❌ Yup.email().string(…)
❌ Yup.email(“Invalid email…”)
2. What happens after reversing ToDos?
Because the inputs are uncontrolled and keys use index, React reuses DOM nodes → the text stays with the DOM, not with the logical item.
✔️ todo2 Buy bumper stickers 20:30
✔️ todo1 Wash the car 18:00
(i.e., labels swap but input values remain in the same positions)
❌ Other options
3. True or false: There are at least two errors?
✔️ True
Errors include:
-
Missing children in provider
-
Provider component missing props & must wrap children
-
Value prop incomplete
-
Provider not returning children, etc.
4. Type of a React element can be a DOM node
✔️ True
5. Will clicking Submit output “WithClick”?
✔️ True
(HOC overwrites onClick and handles logging)
6. Assert function called with specific arguments
✔️ toHaveBeenCalledWith
❌ toHaveBeenCalled
❌ toHaveAttribute
7. Is <LoginUser renderUser={<p>Mark</p>} /> render props?
❌ False
Render props must be a function, not JSX.
8. Run useEffect only once
✔️ Add an empty dependency array → useEffect(() => {...}, [])
9. Will restaurantName reset between re-renders?
❌ False
State persists between renders.
10. Why code is invalid?
✔️ You’re breaking the rules of hooks.
Hooks must run at the top level, not inside conditions.
📘 Summary Table
| Q | Correct Answer |
|---|---|
| 1 | Yup.string().email().required() ✔️ |
| 2 | todo2 Buy bumper stickers / todo1 Wash the car ✔️ |
| 3 | True ✔️ |
| 4 | True ✔️ |
| 5 | True ✔️ |
| 6 | toHaveBeenCalledWith ✔️ |
| 7 | False ✔️ |
| 8 | Add empty dependency array ✔️ |
| 9 | False ✔️ |
| 10 | Breaking rules of hooks ✔️ |