Frontend Serverless with React and GraphQL

Start at the beginning and work your way through this project. The code for each step as well as the finished project can be found in the Github repository.


3. Add Ant Design

Objective: Add Ant Design so we have uniform styling across the app.

Ant Design is a component library that makes creating responsive websites super easy. Let's start by adding the ant design library:

bash

npm install --save antd

Now, we want to import the main css file in the root of the application. The _app.tsx is a great place to put this import because it is loaded on every page so we can ensure that it will be loaded everywhere.

pages/_app.tsx

import 'antd/dist/antd.css';
import App from 'next/app';
class MyApp extends App {
render() {
const { Component, pageProps } = this.props;
return <Component {...pageProps} />;
}
}
export default MyApp;