Skip to main content

AppProvider

Sets up the Polaris AppProvider and injects the App Bridge script.

This component extends the AppProvider component from Polaris, and accepts all of its props except for linkComponent, which is overridden to use the Remix Link component.

Props for the AppProvider component.

string
required

The API key for your Shopify app. This is the Client ID from the Partner Dashboard.

When using the Shopify CLI, this is the SHOPIFY_API_KEY environment variable. If you're using the environment variable, then you need to pass it from the loader to the component.

React.ReactNode

Inner content of the application

For toggling features

| []

The internationalization (i18n) configuration for your Polaris provider.

boolean

Whether the app is loaded inside the Shopify Admin. Default is true.

ThemeName
Examples

/app/routes/**\/*.ts

import {authenticate} from '~/shopify.server';
import {AppProvider} from '@shopify/shopify-app-remix/react';

export async function loader({ request }) {
await authenticate.admin(request);

return json({ apiKey: process.env.SHOPIFY_API_KEY });
}

export default function App() {
const { apiKey } = useLoaderData();

return (
<AppProvider isEmbeddedApp apiKey={apiKey}>
<Outlet />
</AppProvider>
);
}
Was this page helpful?