如何修复TypeError:无法读取未定义的属性'displayName'?反应本机和阿波罗

时间:2019-10-27 04:57:43

标签: javascript react-native graphql node-modules apollo

我收到以下错误(https://i.imgur.com/IpI7yw5.png),但我不知道确切的解决方法,它似乎与node-modules文件夹有关,但我不确定。以防万一我将添加调试器的内容:(https://i.imgur.com/CudcrBO.png

这是我所拥有的与Apollo和graphQL相关的一切: src \ index.js

import React from 'react';
import ReactDOM from 'react-dom';
import { ApolloProvider } from 'react-apollo';
import { ApolloClient } from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import App from './App';
import { networkInterface } from './config';

const apolloClient = new ApolloClient({
  link: new HttpLink({uri: networkInterface}),
  cache: new InMemoryCache()
});

  ReactDOM.render(
    <ApolloProvider client={apolloClient}>
      <App/>
    </ApolloProvider>,
    document.getElementById('root')
  );

新闻列表:

import React, {Component} from 'react';
import {View, Text} from 'react-native';
import axios from 'axios';
import {graphql} from 'react-apollo';
import gql from 'graphql-tag';

const NewsQuery = gql'
query contentView_b0488406c55f4bf5a28ceb86138c948c($first: Int, $skip: Int, $where: PostWhereInput, $orderBy: PostOrderByInput) {
contentView_content_b0488406c55f4bf5a28ceb86138c948c: postsConnection(first: $first, skip: $skip, where: $where, orderBy: $orderBy) {
  edges {
    node {
      status
      updatedAt
      createdAt
      id
      title
      slug
      category
      preview
      body
      author
      date
    }
  }
}
}
'// change ' for tilde 

const NewsWrapper = graphql(NewsQuery)(NewsList);

class NoticiasList extends Component {

  render() {
    const { data } = this.props;
    console.log(data)
  }
}

export default NoticiasList;

我希望获得的实际“结果”是能够运行该应用程序而没有任何错误,并控制台记录阵列中的数据(在我的graphCMS API中,我有一些博客文章)

0 个答案:

没有答案