- Create a project using create-react-app.
- Install the dependencies you would like to use in your App.
- Define your GraphQL schema
- defining schema it means you need to select the type of data which you want to fetch.
How to define your schema
In this case, I will make use of the code from my own project, however I will try by all means to make it super clear. Feel free to ask inthe comment section if you have any challenge in understanding the part of the code which I will share with you. in your schema.js
file
type Country {
name: String
president: President
}
type President {
name: String
countries: [Country]
}
By doing this it means the type of data you want to see on the server side is the country's name and it's president's name too.
After defining the schema you also need to :
- Define your data set.
- Define a resolver.
Top comments (0)