I have to projects where I'm using the useContext() react function to create a user auth context. I'm using the same exact js file in both projects. For some reason in my new project the create context returns a slightly different object than the object in the old projects even though the initialization is identical. This is causing the createContext() function in the new project to return null. The context object in the first project has a calculateChangedBits item which might play a role in I have a theory that this might be due to some sort of react update. Here what is inside the js file. I also added two pictures to show the authUsercontext output for both the old and new project. The old project output is the one with calculateCHangedBits in it.
`import { createContext, useContext, Context } from 'react'
const authUserContext = createContext({
authUser: null,
loading: true,
calculateChangedBits: null,
signInWithEmailAndPassword: async () => {},
createUserWithEmailAndPassword: async () => {},
signOut: async () => {}
});
export const useAuth = () => useContext(authUserContext);`
Top comments (0)