- Fetch your data from Contentful, manage it in React
- Uses the Contentful JavaScript SDK and
swr
to fetch your data.
Clone this repository
git clone https://github.com/contentful/react-starter.git
Install dependencies.
npm install
- Rename the
.env.example
at the root of your project to.env
(so it will be ignored by Git) - Find your Contentful Space ID, your Content Delivery API access token, and Content Management API access token
- In the new
.env
file, replaceYOUR_SPACE_ID
,YOUR_DELIVERY_TOKEN
andYOUR_MANAGEMENT_ACCESS_TOKEN
with the correct values.
The project comes with a Contentful set up command that imports the required content model and adds sample content to your space.
Run the following command to import the content model.
npm run setup
npm start
Open http://localhost:1234 to view it in your browser.
The page will reload when you make changes.
This project uses Parcel. In the project directory, you can run:
Runs the app in the development mode.
Builds the app for production to the dist
folder.