loading table of contents...

Headless Server Developer Manual / Version 2310

Table Of Contents

14.1.2 Setting up a React App

Create React App will be used for this example since it offers a fast and powerful setup to start with. It comes with preconfigured webpack, a development server and tools for testing. For more information on Create React App, see the official documentation. Other configurations, bundlers or tools that help to develop with React are available too.

It is recommended to use TypeScript in your project. This guide is using JavaScript to keep the examples simple. It offers some information on how to configure and develop together with React, Apollo and CoreMedia Headless.

To install Create React App, simply enter the following code in a command line interface:

yarn create react-app headless-example-app

This will download the files into a new folder, named headless-example-app.

After navigating into the new folder, Apollo and GraphQL can be installed as a dependency using yarn like this:

yarn add @apollo/client graphql

This will install the most recent beta version of Apollo 3. It offers improvements on caching, performance and more.

Now the app is complete, and the development server can be started with:

yarn start

Search Results

Table Of Contents

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.