【问题标题】:How do you apply a custom theme to a custom route in React Admin?如何在 React Admin 中将自定义主题应用于自定义路由?
【发布时间】:2020-02-27 16:30:51
【问题描述】:

所以我将自定义主题传递给<Admin />,这对<Resource />s 和loginPage 非常有效。但是,该主题不适用于customRoutes={customRoutes} 中包含的组件。我该怎么做?

const theme = createTheme();

<Admin
  {...providers}
  loginPage={LoginPage}
  history={history}
  theme={theme}
  customRoutes={customRoutes}
>
  <Resource
    name="organizations"
    list={OrgList}
    create={OrgCreate}
    edit={OrgEdit as any}
  />
</Admin>

【问题讨论】:

    标签: react-admin


    【解决方案1】:

    看起来用&lt;ThemeProvider /&gt; 包装&lt;Admin /&gt; 是解决此问题的方法。

    【讨论】:

      猜你喜欢
      • 2019-01-02
      • 2019-07-02
      • 2021-08-19
      • 2020-08-19
      • 1970-01-01
      • 2021-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多