首页 > 解决方案 > 如何将带有 material-ui 的 next.js 嵌入到 keystonejs 中?

问题描述

我正在尝试将带有 material-ui 的 nextjs 嵌入到 keystonejs 中。

我可以让 keystone 和 nextjs 一起玩,没问题。https://www.keystonejs.com/keystonejs/app-next/

而且我可以让nextjs和mui一起玩,没问题。https://github.com/mui-org/material-ui/tree/master/examples/nextjs

但是,当我尝试使用 mui 化的 nextjs 启动 keystone 时,我收到一个与invalid hooks相关的反应错误。

我尝试了该链接中的建议(检查多个 react/react-dom 安装或旧版本等),但还没有找到确凿的证据。

知道我缺少什么额外的步骤来将这一切缝合在一起吗?

这是两人相遇的地方:

# cat index.js | tail -15

module.exports = {
  keystone,
  apps: [
    new GraphQLApp(),
    new AdminUIApp({
      enableDefaultRoute: false,
      authStrategy,
    }),
    new NextApp({
      dir: './nextjs',  // <--- fails when mui present, works without; cd'ing in there and starting with mui (directly, without keystone) works
    }),
  ]
};

谢谢!

标签: reactjsmaterial-uinext.jskeystonejs

解决方案


推荐阅读