How to integrate React with a Shopify App Theme Extension?
What should be the appropriate folder structure and the method for connecting Shopify’s Liquid templates with React components?
How to integrate React with a Shopify App Theme Extension?
What should be the appropriate folder structure and the method for connecting Shopify’s Liquid templates with React components?
Hello, have you created an extension? Could you please explain what you want to integrate with the Shopify app theme extension?
We have created a theme app extension. But we are not able to:
Write react code in theme app extension
Connect shopify liquid to react
Create the right folder structure that’s needed to use react in app extension
Here is quick idea, not a full code.
Create a folder ‘front-app’ and place all your react app code here.
And add
front-app/index.js file will be like
import App from './app';
const element = document.getElementById("react-render")
render(
And in react config, set the output path to theme extension assets folder
```javascript
output: {
filename: '[name].js',
chunkFilename: '[name].js',
path: path.resolve(__dirname, '../extensions/extension-folder/assets'),
},
Trust this will help
We tried this approach but it did not work for us. Being new to Shopify we are kind of stuck. Is it possible for you to share some complete working code without disclosing any confidential stuff?
I am not sure if we will be able to make it work or move to other ecommerce platform as this store is extremely important for us.
Hey did you run this command?
npm run shopify app generate extension
off sitewide
July sale — 45% off at checkout, applied automatically. Valid for 60 minutes. One per customer.
Offer ends in