React Hooks and Lifecycle

Assess your ability to use useState,useEffect,and custom hooks effectively.

1. What does the useState hook return?
2. Which of the following are lifecycle methods in class components?
3. useState can only store primitive values (strings, numbers, booleans).
4. What hook is used to directly access a DOM element or keep a mutable value that doesn't trigger re-renders?
5. Which React Hook is used to manage complex state logic with a reducer function?
6. Which of the following are valid dependencies for the useEffect dependency array?
7. useEffect with no dependency array runs after every render, including the initial mount.
8. What is the term for a function that cleans up side effects, returned by the function passed to useEffect?
9. Which hook is used to memoize the result of an expensive calculation to avoid re-computing on every render?
10. Which lifecycle events can be mimicked using useEffect?
11. Custom hooks can call other hooks.
12. What rule states that hooks must be called only at the top level of function components or custom hooks?
13. What happens if you update state inside useEffect without including the state in the dependency array?
14. Which of the following are considered 'built-in' React Hooks?
15. useLayoutEffect runs synchronously after all DOM mutations, before the browser paints.
Answered 0 of 0 — 0 correct