import React, { createContext, useContext } from 'react'; interface Props { /** * ImgBB API Key */ imgbb_api_key: string; children?: React.ReactNode; } const ImgbbContext = createContext({} as Props); export const ImgbbProvider = ({ imgbb_api_key, children }: Props) => { return ( {children} ); }; export const useImgbb = (): Props => { const context = useContext(ImgbbContext); if (!context) { throw new Error('useImgbb must be used within an ImgbbProvider'); } return context; };