Question 7 of 10Pro Only
What are common pitfalls with dependency arrays in useEffect, useMemo, and useCallback? How do you avoid them?
Sample answer preview
Dependency arrays are essential but a source of many bugs. Here are the most common pitfalls and how to avoid them. Pitfall one is missing dependencies. function SearchResults({ query }) { const [results, setResults] = useState([]); useEffect(() => {…
dependenciesuseEffectstale closureexhaustive-depsreferential equality