← Back
antd apollo-client gist graphql react typescript

Typescript react+antd+graphql boilerplate

A SPA setup with create-react-app, antd and apollo-client

Init project #

npx create-react-app client --template typescript
cd client/

npm i --save antd
rm src/logo.svg
rm src/App.*

Install antd #

npm i --save antd
npm i --save @ant-design/icons

Fix a specific version of moment (see this issue)

npm uninstall moment
npm install moment@2.24.0
npm start

Add App.tsx:

src/App.tsx:

import React from "react";
import Button from "antd/es/button";

const App: React.FC = () => {
return (
<div className="App">
<Button type="primary">Click me!</Button>
</div>
);
};

export default App;

Replace index.css:

src/index.css:

@import "~antd/dist/antd.css";

Add apollo-client #