FACxBeamery / antonio-project-week-6

0 stars 0 forks source link

Variable missing from useEffect #11

Closed arrested-developer closed 5 years ago

arrested-developer commented 5 years ago

https://github.com/FACxBeamery/antonio-project-week-6/blob/ef49f343a2046978d628aed6ff19132fb2723ff5/antonio-week-6/src/components/board.js#L26

You should see an eslint message here, warning that setApod should be in the array provided to useEffect. This will still have the same effect of running the effect once after the first render, but it will satisfy React that if the useApod function is mutated, this instance of useEffect will update to reflect the change. It's a situation I doubt would be happening in your app, but the function name should still be included in the array.

arrested-developer commented 5 years ago

There's a similar warning in board-grid.js - these warnings are very helpful, please give them a good read

AntonioGargaro commented 5 years ago

Fixed!