Problem in useContext on react js when I practise Codesandbox! Please

Viewed 26
1 Answers

You should wrap your main application in the provider you have written. A ton of information can be found at the react docs

import "./styles.css";
import Child from "./Child";
import { AppProvider } from "./UserContext";
export default function App() {
  return (
    <div className="App">
      <AppProvider>
        <Child />
      </AppProvider>
    </div>
  );
}
Related