How to update the Context value in a Provider from the Consumer? [duplicate]
You could use the useContext hook to achieve this. It’s quite easy to use it in the child elements of the Provider. As an example… authContext.js import { createContext } from “react”; const authContext = createContext({ authenticated: false, setAuthenticated: (auth) => {} }); export default authContext; Login.js (component consuming the Context) import React, { useContext … Read more