79207809

Date: 2024-11-20 15:15:35
Score: 1.5
Natty:
Report link

This error is due to the fact that type "null" is not destructurable at: const AuthContext = createContext<AppContext | null>(null);

A better approach is to assign the default value an empty object and declaring its type as the context type (AppContext):

const AuthContext = createContext< AppContext > ({} as AppContext);

Happy coding!

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: 0xTwisted07