Installing Packages to Use React with Apollo GraphQL

Finally, in this lesson, we will install packages that required to use React with Apollo GraphQL

For this application, no elaborate React setup is needed. Simply use create-react-app to create your React application. If you want to have an elaborate React setup instead, see this setup guide for using Webpack with React. To get started, the following steps have to be performed:

  • Create a new React application with create-react-app
  • Create a folder/file structure for your project (recommendation below)

You can create your own folder and file structure for your own components in the src/folder; the following top-level structure is only a recommendation. If you adjust it to your own needs, keep in mind that the JavaScript import statements with their paths will need to be adjusted to match. If you don’t want to create everything, you can clone this GitHub repository instead and follow its installation instructions.

  • App/
    • index.js
  • Button/
  • Error/
  • FetchMore/
  • Input/
  • Issue/
    • IssueList/
    • IssueItem/
    • index.js
  • Link/
  • Loading/
  • Organization/
  • Profile/
  • Repository/
    • RepositoryList/
    • RepositoryItem/
    • index.js
  • TextArea/
  • constants/
    • routes.js
  • index.js
  • serviceWorker.js
  • style.css

Get hands-on with 1200+ tech skills courses.