Skip to main content

App state

You can access the app state using a React hook.


The useAppBridgeState hook supports accessing all or parts of the application state, including keys like context, features, and staffMember. For more information about options, refer to Props.

Note

When using the App Bridge React library, you need to wrap all of your App Bridge React code inside of a single App Bridge Provider.

Get the entire app state with no arguments.

import {useAppBridgeState} from '@shopify/app-bridge-react';

function MyComponent {
const appState = useAppBridgeState();

...
}

Get a specific piece of the app state with an argument.

import {useAppBridgeState} from '@shopify/app-bridge-react';

function MyComponent {
const staffMember = useAppBridgeState('staffMember');

...
}

NameTypeDescriptionRequired
state"cart", "client", "context", "contextualSaveBar", "features", "fullscreen", "isLegacy", "loading", "menu", "modal", "navigation", "pos", "print", "resourcePicker", "scanner", "sessionToken", "share", "staffMember", "titleBar", "toast"Key in app state to accessNo

Was this page helpful?