feat: AtomsProvider component (#12354)

* init: atoms provider component

* chore: add atoms provider to index of atoms package

* cleanup comments
This commit is contained in:
Rajiv Sahal
2023-11-14 20:47:48 +05:30
committed by GitHub
parent ada74467bc
commit 90d52663ac
3 changed files with 18 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
export { AtomsProvider } from "./index";
export * from "../types";
+15
View File
@@ -0,0 +1,15 @@
import type { ReactNode } from "react";
import { createContext, useContext } from "react";
type AtomsProviderProps = {
apiKey: string;
children: ReactNode;
};
const ApiKeyContext = createContext("");
export const useApiKey = () => useContext(ApiKeyContext);
export function AtomsProvider({ apiKey, children }: AtomsProviderProps) {
return <ApiKeyContext.Provider value={apiKey}>{children}</ApiKeyContext.Provider>;
}
+1
View File
@@ -1 +1,2 @@
export { Booker } from "./booker/Booker";
export { AtomsProvider } from "./atoms-provider/index";