graphql-go / graphql-go/graphql

Please provide an operation name! Graphql/examples/todo + react-native apollo

Open
#326 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

```
const TODO_LIST_QUERY = gql` query todolist{ todoList{id,text,done}}`;

type Todo = {
id: string;
text: string;
done: boolean;
};
type Response = {
todoList: Todo;
}

const todoQuery = graphql<{}, Response>(TODO_LIST_QUERY, {});

class TodoList extends Component, {}> {
render() {
const { loading, todoList, error } = this.props.data;
if (loading) return Loading;
if (error) return {JSON.stringify(error)};
if (!todoList) return no data;
return (

{JSON.stringify(this.props)}

this.openItem(item)}
onLongPress={() => this.alertMenu(item)} />
}
keyExtractor={(item, index) => index.toString()}
style={styles.flatList} />

)
}
}

export default todoQuery(TodoList);
```
url: http://167.99.64.4:8080/graphql (You may use this)
It print error "Please provide an operation name". What happen to it?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.