【发布时间】:2018-05-14 22:39:35
【问题描述】:
我正在尝试使用 GraphQL 为 Styleguidist 填充假数据。我正在使用 Express 来制作我的 GraphQL 服务器,但我不确定如何将 Apollo 连接到 Styleguidist?示例使用 index.js 文件并将根组件包装在 Apollo 的标签中。
我不确定 Styleguidist 是如何工作的,我不知道 index.js 文件在哪里。
有通过webpack配置Styleguidist的方法,但是不知道怎么用webpack来使用Apollo。
【问题讨论】:
-
你指的是什么例子?
-
我正在观看 Udemy 上的课程,但也在 blog.graph.cool/…,如果您向下滚动到“现在我们正在将所需的包导入 src/index.js”。它让你知道一些配置,但也建议 React.dom 方法看起来像: ReactDOM.render((
), document.getElementById('root') ) -
在模块的某处是否有 Styleguidist 的主 index.js 文件?
-
我尝试在 ApolloProvider 标签中包装组件 Button,我得到的错误消息是: Invariant Violation: could not find "client" in the context of "Apollo(Button)"。将根组件包装在
中 -
我正在尝试使用 Wrapper 方法,如下所示:react-styleguidist.js.org/docs/… 但我认为这不是票,因为它包装了所有单独的组件。在我看来,我需要一种包装根组件的方法,因为这就是示例所做的并且就是上面的错误消息。
标签: javascript graphql apollo react-styleguidist