Skip to content

Instantly share code, notes, and snippets.

@code08-ind
Created March 29, 2021 13:05
Show Gist options
  • Save code08-ind/f1a6b56669da448c457f4e44e25f3e53 to your computer and use it in GitHub Desktop.
Save code08-ind/f1a6b56669da448c457f4e44e25f3e53 to your computer and use it in GitHub Desktop.
import React, { createContext } from 'react';
import ComponentA from './ComponentA';
const FirstName = createContext();
const LastName = createContext();
const UseContext = () => {
return (
<>
<FirstName.Provider value={"Aryan"}>
<LastName.Provider value={"Garg"}>
<ComponentA/>
</LastName.Provider>
</FirstName.Provider>
</>
);
}
export default UseContext;
export { FirstName, LastName };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment