要使用Apollo开发工具,需要确保在Apollo配置文件中正确设置了服务器地址和应用程序ID。例如:
import { ApolloProvider } from 'react-apollo'
import ApolloClient from 'apollo-boost'
const client = new ApolloClient({
uri: 'http://localhost:4000/graphql', // 服务器地址
})
ReactDOM.render(
,
document.getElementById('root')
)
如果服务器地址和应用程序ID正确设置,尝试使用Apollo Devtools中“Reset to initial state”按钮重置状态树,并确保在查询后刷新页面,以确保数据正确显示。