4 ms·
// Good: This logic should run because the component was displayed useEffect(() => { post('/analytics/event', { eventName: 'visit_form' }); }, []); An
by rickstanley 4y ago
// Good: This logic should run because the component was displayed
useEffect(() => {
post('/analytics/event', { eventName: 'visit_form' });
}, []);
And then a wild 'exhaustive-deps'[0] appears!
[0]: https://github.com/facebook/react/issues/14920 https://github.com/facebook/react/issues/14920
- andrewingram 4y agoThere aren't any function-scope variables used here, so an empty dependency array is correct.