wizard-a / mf-demo

Umi支持Webpack5的Module Federation的Demo案例
4 stars 0 forks source link

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app #2

Open yangye0817 opened 2 years ago

yangye0817 commented 2 years ago

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
jiaozitang commented 2 years ago

我也遇到了这个问题

kevin031612 commented 2 years ago

把mf1和mf2的shared都改为: shared: ['react'] 即可