Usage & Provider Setup
The ImagineoAIProvider component wraps your app and provides the ImagineoAI client via React context.
Example
import { ImagineoAIProvider } from '@imagineoai/react';
function AppRoot() {
return (
<ImagineoAIProvider getToken={getToken} apiUrl="https://api.imagineo.ai">
<App />
</ImagineoAIProvider>
);
}
getToken: A function returning a promise with your API token (see authentication docs).apiUrl: The base URL for the ImagineoAI API.
Using Hooks
You can use the provided hooks anywhere inside your provider:
import { useGenerateImage } from '@imagineoai/react';
const { generateImage } = useGenerateImage();
See the Hooks Reference for all available hooks.