Closed cgimpl closed 2 years ago
I think you are mistaking a set-function returned from useState
with the setState
method from class-components.
The latter will take a callback function but not with the useState hook. With functional components a useEffect
hook is used when requiring an action to take place after the state got changed to trigger an additional rerender if needed.
https://github.com/ngschaider/bier-in-aktion-webapp/blob/476083165a7f5106f0f33366d9b193b9e11e2deb/src/components/ProductCardContainer.tsx#L11