I would like to see how I can create global contexts in NextJS and have global variables inside the app.
Currently I have AppContext.js as
import { createContext } from 'react'
const AppContext = createContext();
export default AppContext
_app.js
const [socketio, setSocketio] = useState(null);
const appContext = {
socketio
};
return(
<AppContext.Provider value={ appContext }>
<Component {...pageProps} />
</AppContext.Provider>
)
How can I access the appContext values from another component? Thank you!