alibaba / ice

🚀 ice.js: The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
https://ice.work
MIT License
17.81k stars 2.09k forks source link

[QUESTION]弹窗如何继承auth #6827

Closed xmsz-stu closed 4 months ago

xmsz-stu commented 4 months ago

Describe the bug

import { useAuth } from 'ice';
Dialog.show({
            content: (
                <A />
            ),
          });
const A = () => {
  console.log(600, useAuth());
  return <div />;
};

这里组件拿到的是null

Expected behavior

弹窗能获取到useAuth数据

Actual behavior

No response

Version of ice.js

2.x

Content of build.json or ice.config.mts

No response

Additional context

No response

ClarkXia commented 4 months ago

<Dialong /> 组件,或者调用 Dialog API 的时候把 useAuth 的指作为 A 组件的 props 传递

xmsz-stu commented 4 months ago

有没有类似store.Provider或者如何自己实现,因为有些Dialog里的组件是和页面共用的