React Context to pass data through a component tree without having to manually thread props.
global data.Creating a Context
// PupContext.js
import { createContext } from "react";
const PupContext = createContext();
export default PupContext;React.createContext to create context.
Adding a Provider to the App component
Setting up a Consumer
Context.Consumer expects a function as a child.
Context.Provider