How to fix missing dependency warning when using useEffect Hook to update state when props change

It won’t have any effect on how your script runs, but the linter is warning you to change it to:

useEffect(() => {
}, [setSelectedText, urlText]);

useEffect(() => {
    return () => {
}, [clearPage]);

Though the last can be simplified to:

useEffect(() => clearPage, clearPage);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top