What are these three dots in React doing? Firstly, you don't want to interrupt your user. NodeJS : TypeError: Cannot destructure property `db` of 'undefined' or If this is not considered a common use-case, then I would recommend an approach similar to React Router, where useFormikContext() would throw if no context is found. It looks like when you initialize your context (via createContext () ), you didn't pass in any value ( and thus it's undefined ). I added this wrapping in the index.js file to resolve the issue. Connect and share knowledge within a single location that is structured and easy to search. Bucket you put your password there? This issue is stale because it has been open 30 days with no activity. . Additionally, if I'm reading the types properly I believe the TS types do not reflect this possibility, so even running TS with --strictNullChecks may not flag this as apotential case to handle. What is the difference between .ts and .tsx extensions. You're not sending any props to the App component, so { steps } is undefined, and you can't destructure the property "steps" because it's undefined. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Hopefully that means my issue got fixed with one of the other prereleases. When a gnoll vampire assumes its hyena form, do its HP change? javascript - React "cannot destructure property" - Stack Overflow javascript - Cannot destructure property - Stack Overflow to your account, Route renders with the data with no console errors or weird rerendering, Page re-renders oddly and appears to work, but console log shows. One option is defining defaults into the state from props. Array : Setting state returns returns undefined, Cannot destructure property "title of . This would also "fix" the TypeScript typings such that undefined could never be returned: This would indicate to the caller that useFormikContext() would always return a Context