I have been having a lot of problems with my npm packages in my React Native app, and thought that I had been able to solve most of them. However, when I try to navigate to any of my screens that use props or state, the app crashes with the following errors (or similar)
TypeError: undefined is not an object (evaluating 'state.')TypeError: undefined is not an object (evaluating 'props.')
Any idea how to fix this? I have tried updating my npm packages and cleaning them but to no luck.
The areas where the error is being highlighted are:
const someVariable = useSelector( (state: any) => state.thing.thing);
Specifically the error is pointing to the useSelector
part of that.
And also:
const isAuthenticated = useSelector( (state: any) => state.auth.authenticated);
The error isn't pointed out specifically, but I assume it is also useSelector.
This has worked fine previously, it has only stopped working following updating and cleaning the packages.