Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote module with shared react with react hooks #462

Open
yuvalbne opened this issue Jul 16, 2023 · 5 comments
Open

Remote module with shared react with react hooks #462

yuvalbne opened this issue Jul 16, 2023 · 5 comments

Comments

@yuvalbne
Copy link

Versions

"@originjs/vite-plugin-federation": "^1.2.3",
"vite": "^4.3.9",
"@vitejs/plugin-react": "^4.0.0",

Reproduction

What is Expected?

To work great with the hook.

What is actually happening?

I get:
Uncaught TypeError: Cannot read properties of null (reading 'useState')

Same code without the useState hook works great!

Any ideas how to fix? workaround?
I think the opened PR is supposed to fix this issue?
#450

Thanks community!

@bw-kshitij-vengurlekar
Copy link

Facing same issue

@yuvalbne
Copy link
Author

@bw-kshitij-vengurlekar Did you solve it somehow?

@swalker326
Copy link

I'm not at my computer right now. But I think the issue is you're not sharing react. I'll have to get back to me keyboard to confirm. If you go into source in the browser you should see federated react and that's the use state the remote should be using.

@pscl4
Copy link

pscl4 commented Sep 15, 2023

Bildschirmfoto 2023-09-15 um 13 22 49

Hi same for me:
As soon as I'm using hooks in Host or Remote its not working for v1.3.1
(using build versions and vite preview for host+remote)

Removing the hooks, it works just fine
And it is even working fine for v1.2.1 with hooks

@billdwhite
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants