
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@shopify/app-bridge-react
Advanced tools
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
@shopify/app-bridge-reactJoin our team and work on libraries like this one.
Shopify App Bridge offers React component wrappers for some App Bridge actions. This is a great option if you are already using React and want to follow familiar patterns.
Instead of using App Bridge actions directly:
import createApp from '@shopify/app-bridge';
import {TitleBar} from '@shopify/app-bridge/actions';
const app = createApp({
apiKey: 'API key from Shopify Partner Dashboard',
host: 'host from URL search parameter',
});
const titleBarOptions = {
title: 'My page title',
};
const myTitleBar = TitleBar.create(app, titleBarOptions);
Use the React component wrappers:
Note: only one
Provideris needed for your application.
// MyApp.jsx
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from '@shopify/app-bridge-react';
import {RedirectButton} from './RedirectButton';
function MyApp() {
const config = {
apiKey: 'API key from Shopify Partner Dashboard',
host: 'host from URL search parameter',
};
return (
<Provider config={config}>
<RedirectButton />
</Provider>
);
}
const root = document.createElement('div');
document.body.appendChild(root);
ReactDOM.render(<MyApp />, root);
To access an app from the Provider, use the useAppBridge hook (since v1.25.0):
// RedirectButton.jsx
import {Button, Redirect} from '@shopify/app-bridge/actions';
import {useAppBridge} from '@shopify/app-bridge-react';
function RedirectButton() {
const app = useAppBridge();
const redirect = Redirect.create(app);
const handleClick = () => {
// Go to {shopUrl}/admin/customers with newContext
redirect.dispatch(Redirect.Action.ADMIN_PATH, {
path: '/customers',
newContext: true,
});
};
return <Button onClick={handleClick}>Activate Lasers for Customers</Button>;
}
There are two breaking API changes in version 3.0.0.
useContextualSaveBaruseToastIn version 2.x.x, useContextualSaveBar was called with all of its options. It then created the contextual save bar and dispatched show and hide functions as an internal side effect based on the visible prop and any changes in options. It did not return anything.
useContextualSaveBar({
discardAction,
saveAction,
fullWidth,
leaveConfirmationDisable,
visible,
});
In version 3.0.0, useContextualSaveBar becomes more declarative. The hook is called without any props and it returns several objects and methods that can be used to update contextual save bar options, as well as to show and hide the component.
const {show, hide, saveAction, discardAction} = useContextualSaveBar();
const fullWidth = true;
const leaveConfirmationDisabled = false;
<Button
primary
onClick={() => {
show(fullWidth, leaveConfirmationDisabled);
discardAction.setOptions({onAction: () => console.log('On discard')});
saveAction.setOptions({onAction: () => console.log('On save')});
}}
>
Show ContextualSaveBar
</Button>
<Button onClick={hide}>Hide ContextualSaveBar</Button>
See useContextualSaveBar docs for more details.
In version 2.x.x, useToast returns a show method that accepts one prop - an object with the following properties:
contentdurationisErroronDismissAll the props except content are optional.
const {show} = useToast
show({
content: 'Success!,
duration: 2000,
isError: false,
onDismiss: () => console.log('Dismissed'),
})
In version 3.0.0, the content moves to a top-level prop and the remaining properties are passed in as an optional options prop (all properties in the options object remain optional).
`
const {show} = useToast;
show('Success!', {
duration: 2000,
isError: false,
onDismiss: () => console.log('Dismissed'),
});
See useToast docs for more details.
If you are using App Bridge v1.24.0 and below, or your project does not support React hooks, alternative methods on how to access app can be found in the Provider docs.
FAQs
React wrappers for the Shopify App Bridge library
The npm package @shopify/app-bridge-react receives a total of 157,621 weekly downloads. As such, @shopify/app-bridge-react popularity was classified as popular.
We found that @shopify/app-bridge-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.