小编CSt*_*ele的帖子

react-apollo 网络错误:查询“Hello”缺少服务器响应

我正在尝试使用以下代码设置 react-apollo:

import React from 'react';
import {render} from 'react-dom';

import gql from 'graphql-tag';
import { ApolloProvider, graphql } from 'react-apollo';
import { ApolloClient } from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';


const client = new ApolloClient({
  link: new HttpLink({ uri: 'http://localhost:5000/graphql' }),
  cache: new InMemoryCache()
});



class App extends React.Component {
  render () {
    return <p> Hello React project</p>;  }
}
const MY_QUERY = gql`query Hello { hello }`;

const AppWithData = …
Run Code Online (Sandbox Code Playgroud)

javascript apollo reactjs graphql react-apollo

5
推荐指数
1
解决办法
3649
查看次数

标签 统计

apollo ×1

graphql ×1

javascript ×1

react-apollo ×1

reactjs ×1