ScriboI Write

Jest+React-tips

Wed Sep 07 2022 12:27:00 GMT+0000 (Coordinated Universal Time)

Cannot update state on unmounted component.

Solution to this is to wrap end of test in waitFor(()=>{}) I assume this works because it prevents jest from trying to unmount the component before the state updater runs. I've looked everywhere and can't find another solution.