How to consume two different context in the same component using useGlobalContext

I created one file for a context and use the useGlobalContext to dostruct the functions and variables I need in the traget component , now I need to create a separate file for a different context and I want to consume this context in the same component I mentioned earlier , how we will use useGlobalContext in this case ?

for example if i have a context file and have the following code in it

export const useGlobalContext = () => {
  return useContext(AppContext);
};

then destructed it inside of a component like so

const { isSidebarOpen, closeSidebar } = useGlobalContext()

then i can use the same hook if i have a different context file and i want to destruct it inside the same component?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.