Skip to content

🧐[问题 | question]如何在apptsx/rootContainer提供全局provider中使用useIntl? #11483

Open
@birdycn

Description

@birdycn
export function rootContainer(container: any) {
  const intl = useIntl();
  console.log(intl);
  return React.createElement(
    ThemeProvider,
    {
      theme: {
        token: {
          colorPrimary: defaultSettings?.colorPrimary,
          colorInfo: defaultSettings?.colorPrimary,
        },
      },
    },
    container,
  );
}

报错:
× Unhandled Rejection (TypeError): Cannot read properties of null (reading 'useContext')

我想要为form 表单验证提供全局翻译文件(动态的,国际化的)

如果使用provier只能直接配置一个翻译模板,希望通过全局useInlt来切换翻译语言模板,应该怎么做

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions