feat: AtomsProvider component (#12354)
* init: atoms provider component * chore: add atoms provider to index of atoms package * cleanup comments
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export { AtomsProvider } from "./index";
|
||||
export * from "../types";
|
||||
@@ -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 +1,2 @@
|
||||
export { Booker } from "./booker/Booker";
|
||||
export { AtomsProvider } from "./atoms-provider/index";
|
||||
|
||||
Reference in New Issue
Block a user