Can you show any code or errors?
Topic summary
Developers are exploring how to use React within Shopify theme app extensions, which traditionally rely on Liquid templates and vanilla JavaScript. The core challenge is that app blocks don’t natively support React frameworks.
Established Solution:
- Bundle React apps into a single JavaScript file using tools like Webpack or Vite
- Reference the bundled file (e.g.,
bundle.js) in the app-block’s Liquid schema under thejavascriptproperty - Create React source code in a separate folder outside the extension directory
- Configure the build tool to output the compiled bundle into the extension’s
/assetsfolder
Common Implementation Issues:
- React requires a DOM element to mount to, which must be defined in the
.liquidfile - Asset management (images, CSS) becomes complicated when transitioning from Liquid to React
- Developers struggle with proper folder structure and build configuration
- Size limits and Shopify’s restrictions on extension folder contents create constraints
Resources & Alternatives:
- A community member shared a template repository demonstrating React + Tailwind CSS setup
- Settings can be passed from Liquid schema to React via data attributes on the root div
- At least one developer abandoned this approach entirely, opting to embed their React app as an externally-hosted iframe
Status: The discussion remains open with ongoing questions about asset handling and build configuration. Multiple participants note that Shopify’s documentation lacks comprehensive guidance on React integration.
1 Like