Hello-World-Software-Studios / calculator

Carpenter's tool for wall layout
0 stars 1 forks source link

Follow exhaustive deps #24

Closed ecumene closed 3 years ago

ecumene commented 3 years ago

Either wrap layoutWall in a useCallback or just call setListOfMeasurements(makeAList); directly in your function.

https://github.com/Hello-World-Software-Studios/calculator/blob/c4bec9890d695b722df2186732f6c1e14ee283cb/src/components/calculator.jsx#L32

https://stackoverflow.com/questions/58866796/understanding-the-react-hooks-exhaustive-deps-lint-rule

JPM709 commented 3 years ago

So I simply removed layoutWall. it was sort of redundant, calling a function that calls a single function.

const handleSubmit = (event) => { event.preventDefault(); setListOfMeasurements(makeAList(wallLength, onCenterSpacing, studOffset, isImperialUnit)); }