Comments (6)
Thanks for writing an issue on this, @norama 🙌 I'm running Astro in production with React micro-frontends and it works fine with useState
. This error is caused by running Astro in dev mode and app-a in production mode. Astro has its own React version in dev mode which is the reason for the error you've mentioned.
If you want to run the apps locally you have to run Astro with npm run preview
. Sorry for not being clear on this in the readme, I'll update it as soon as possible!
from astro-microfrontends.
Another approach would be to allow different versions of react running in the shell, though I have not tried it with useState
. Here's an example on how to do it with injection points for the micro-frontends.
from astro-microfrontends.
Thanks a lot for the quick answer and update!
It is working with npm run preview
just in this case there is no hot module reload and other nice dev mode stuff...
How do you use dev mode?
Or just use dev mode for the microfrontends in isolation and using prod mode always when running astro with the microfrontends together?
from astro-microfrontends.
Another approach would be to allow different versions of react running in the shell, though I have not tried it with
useState
. Here's an example on how to do it with injection points for the micro-frontends.
Thanks, this is working with npm run dev
!!!
from astro-microfrontends.
Awesome. I usually develop each app in isolation in dev mode. In each micro-frontend you can add a page layout in index.css
and import it in main.tsx
. This won't get bundled to production because the entry point is Microfrontend.tsx
For the Astro app, you can mock the micro-frontend bundles in a local server and run it in dev mode.
from astro-microfrontends.
Closing this issue, I'm planning on adding more documentation in the future!
from astro-microfrontends.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro-microfrontends.