DEV Community

Kudzai Murimi
Kudzai Murimi

Posted on • Updated on

Get started with React GraphQL App in few steps.

  1. Create a project using create-react-app.
  2. Install the dependencies you would like to use in your App.
  3. Define your GraphQL schema
  4. 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]
}
Enter fullscreen mode Exit fullscreen mode

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 :

  1. Define your data set.
  2. Define a resolver.

Top comments (0)