How to redirect the page react.js in embedded app?

Highlighted

I have created an app using a react.js platform.
I'm facing the issue while redirect to the second page. The route is not appending the URL to the main page URL.
How can we redirect the page in react.js?

looking forward to hearing from you.

0 Likes
Highlighted
Excursionist
38 1 8

Hi,

Try to use App Bridge Redirect

import { Context } from '@shopify/app-bridge-react';
import { Redirect } from '@shopify/app-bridge/actions';

<Context.Consumer>
{(app) => (
<Button
onClick={() => {
const redirect = Redirect.create(app);
redirect.dispatch(
Redirect.Action.APP,
'url goes here ...',
);
}}
>
</Button>
)}
</Context.Consumer>

 

https://apps.shopify.com/picamaze
Animated watermarks for product images and ads
0 Likes