GraphQLの新機能であるので、私はグラファンのdjangoの実装に2つのモデルを用意していますが、どちらかといえば、graphene docs' exampleとよく似ています。graphene djangoリレー:リレー変換エラー
graphiqlでは、これを実行して結果を返すことができます。
別relay tutorial後、私は画面上にこのクエリの結果をレンダリングしようとしています。
私の試みは次のようになります。
class Note extends Component {
render() {
return(
<div> {this.props.store.title} </div>
)
}
}
Note = Relay.createContainer(Note, {
fragments: {
store:() => Relay.QL`
fragment on Query {
note(id: "Tm90ZU5vZGU6MQ==") {
id
title
}
}
`
}
});
class NoteRoute extends Relay.Route {
static routeName = 'NoteRoute';
static queries = {
store: Component => {
return Relay.QL`
query {
${Component.getFragment('store')}
}
`},
};
}
私のブラウザのコンソールには、次のようなエラーが表示されます。
Uncaught Error: Relay transform error ``There are 0 fields supplied to the query named `Index`, but queries must have exactly one field.`` in file `/Users/.../src/index.js`. Try updating your GraphQL schema if an argument/field/type was recently added.
私は限られた成功を収めて自分自身でそれを理解しようとしてきました。
誰かが正しい方向に向かうことができますか?
を。あなたの 'NoteRoute'では、クエリに1つのフィールドと正確に1つのフィールドが必要です。 – stubailo