Ant Design Pro v4 がリリースされました

![](https://cdn.nlark.com/yuque/0/2019/png/84868/1559117148716-9f0bac60-c8cb-408c-9b15-40d5e8580a0b.png#align=left&display=inline&height=150&originHeight=290&originWidth=1440&status=done&width=746)


It has been 8 months since the last release of Pro. We keep updating, but most of them are focused on  bug fix. During this time we have encountered many pain points using Pro and are also thinking about how to solve these problems. At the same time, the entire front-end industry is also changing. With the complexity of the business, the micro-front end has come to the fore. Hundreds of pages like Alibaba Cloud's console will have more and more collaborative projects. Serverless is in the ascendant, and the cloud on the front end is still being explored with new challenges every day.

V4 is our latest attempt to meet the challenge. We bring TypeScript, Layout component, blocks and move components from Pro to Ant Design. At the same time, we also brought new ways to create projects, significantly reducing redundant code.

<a name="NLkCo"></a>
### 🚀 Quick Start

Create a new empty folder as the project directory and execute follow command in it:

```bash
yarn create umi // or npm create umi
```

Choose `ant-design-pro`:

```bash
Select the boilerplate type (Use arrow keys)
❯ ant-design-pro  - Create project with an layout-only ant-design-pro boilerplate, use together with umi block.
  app             - Create project with a simple boilerplate, support typescript.
  block           - Create a umi block.
  library         - Create a library with umi.
  plugin          - Create a umi plugin.
```

The Ant Design Pro scaffolding will be installed automatically.


### ✨ Upgrade to v4

Ant Design Pro 4.0 is compatible with all the features of 2.0, and there is no need to make any changes to upgrade from 2.0 to 4.0. In Ant Design Pro 4.0, we striped the Layout into [separate component](https://github.com/ant-design/ant-design-pro-layout). You can choose to replace it with the latest one.

```bash
npm i @ant-design/pro-layout --save
```

Under the `src/layouts` directory, remove `BasicLayout.js` and `BasicLayout.less`. Replace it with the [new version of `BasicLayout.tsx`](https://github.com/ant-design/ant-design-pro/blob/v4/src/layouts/BasicLayout.tsx).

> If you modified the original `BasicLayout`, remember to apply the changed logic to the replaced file.



### 🏆 TypeScript

In v4, both scaffolding and blocks are refactored with TypeScript. TypeScript is incredibly effective for development, and a good ecology can greatly reduce the time of your query API. It can also eliminate the wrong parameters, or misspelling variable names. Even better, because of its powerful type of expressiveness, you can read an old project more easily. Because the type can be used as a document under certain circumstances.

The greater advantage of TypeScript is that it simplifies the difficulty of refactoring. TypeScript's static type checking will make you more productive when you take over a less robust legacy code. Refactoring can cause type errors that can be discovered at development time. For example, upgrading antd@2 to antd@4, if you don't have TypeScript, it's hard to imagine how much psychological pressure you have to take when you go online.

We hope that one day when you take over the project, you will find that it uses Pro's scaffolding to make you feel at ease. You can get started quickly, develop quickly, and use the same abstract model and code style. To do this better, TypeScript is an essential part.

For non-Typescript users, we also provide an additional version of JavaScript. You can choose JavaScript scaffolding when you initialize your project.
> 👎 JavaScript loses a lot of features and is not friendly enough for editors. We strongly recommend that you give priority to using TypeScript.

[](https://www.yuque.com/ant-design/ant-design-pro/ant_design_pro_2.0_is_out#lczipy)

### 📦 Layout

In the v2 version, the process for starting a new project is generally:

1. Clone project
1. Delete unused pages
1. Start development

Most of the reference pages are not necessarily used, but Layout is definitely reserved 😁.

Pro's Layout has a lot of great features. For example, automatically generated menus, breadcrumbs and a variety of beautiful layouts. Even a  new to the front end developer can also quickly build a framework for his project.

But the power is also cumbersome. Even worse, we exposed all the code details to every user. Although Layout seems to be just a UI, the logic is spread across multiple files. For developers,  may only focus on the display effect, but in order to modify a small place may need to jump in several files, but also need to carefully observe the flow of data. This is a big problem for developers. Not to mention the cumbersome upgrade method, almost no users will upgrade the layout when the performance is normal.

In order to solve these problems, we extracted the layout in v4. Now it re-debuts as a package, retaining almost all of its original features! Just use a few lines of code:

```typescript
import ProLayout from '@ant-design/pro-layout';

render(
  <ProLayout
    logo={<img src="https://demo.com/logo.png" />}
  	layout="sidemenu"
    navTheme="dark"
    fixSiderbar
    locale="zh-CN"
  />
, document.getElementById('root'));
```

Maybe your code has been in shape for a long time, but it doesn't matter, you can also access it quickly. And it is only coupled with antd. This means it can support all scaffolding.

In terms of customizability, we provide a very large number of render methods. You can almost customize render any block menu, header, footer or even title. In terms of api, it is close to the mature solution of antd. If you are familiar with antd, it will be used like a powerful antd component without the cost of getting started.

If you want to try it immediately, look here [@ant-design/pro-layout](https://github.com/ant-design/ant-design-pro-layout). Welcome to like, spit or initiate PR.


### 🐱 Component

A range of components are available in v2. But in v4, we removed them and moved to antd gradually. In antd, they get better support, a better community, and a more robust api.

There are some components you can start using right now, such as [Descriptions](https://ant.design/components/descriptions-cn/), [PageHeader](https://ant.design/components/page-header-cn/), [Typography](https://ant.design/components/typography-cn/). These components can meet a very large number of page display needs. For those components  which are heavily business-oriented, we tend to use blocks for installation.


### 🎯 Block

In v4 we split Pro's assets into two pieces, Layout and Pages. All interfaces are composed of these two parts. We've componentized Layout to provide development efficiency, and blocks are our solution for Pages. Each block is a page that can take its own state, localize, and even mock data and server. Umi-based capabilities allow them to be easily and quickly integrated into scaffolding.

Due to the feature of the block. Your new project will be very concise, with no extra dependencies, and no bunch of pages you can't use. It looks like this:<br />![image.png](https://cdn.nlark.com/yuque/0/2019/png/84868/1559194759933-12b10c00-821f-4638-b465-6960f75f7875.png#align=left&display=inline&height=1181&name=image.png&originHeight=1181&originWidth=1792&size=190656&status=done&width=1792)<br />If you need a page from Pro, you can add it quickly via the block. In Pro's demo site we have added a button. When you want to use this page into your project, you can download this block into your project by clicking and copying the following line of code. It's as simple as going to the mall to buy a product:

![image.png](https://cdn.nlark.com/yuque/0/2019/png/84868/1559116913002-eba15a1c-4fb3-41ac-b74a-27d131c3d2bb.png#align=left&display=inline&height=186&name=image.png&originHeight=186&originWidth=656&size=18878&status=done&width=656)

If you want it all (wow!), you can run `npm run fetch:blocks` in your project, and our script will download all the Pro blocks to the project for your presentation.

Blocks also cause problems while bringing benefits. The most significant is the amount of redundant code, which will be the focus of our future work.


### 🧩 Ant Design 4.0 

We expect to **release the Ant Design 4.0 release in Q4 this year **🍻. The main objectives are:

1. facing the future
1. Maximum backward compatibility
1. Faster and smaller

You can see detailed expansion instructions [here](https://medium.com/ant-design/ant-design-4-0-is-in-progress-d46e53327038).


### 🥇 Looking to the future

Since the release of the first version of @afc163 on October 29, 2017, there have been many changes to the Pro in 2019.<br />The underlying framework was modified to umi, the code organization was changed to block, and the TypeScript was completely embraced.<br />It can be said that the Pro has changed dramatically.<br />Ant Design also released the 4.0 plan, as a huge version upgrade, 4.0 will solve some of the problems that have been criticized. Includes From rewrites, more new components, more powerful performance, and so on.

Ant Design Pro and Ant Design will continue to iterate in the future. But no matter how the code changes, our initial intentions and vision will not change. That is to bring the most extreme development experience and improve the development efficiency for each user.


### 🌚 one more thing

Most browsers already support dark mode. Ant Design Pro and Ant Design are also do some work on the dark theme. Current solution may not reach the expect, but you can still have a try.


### 🤝 Special Thanks
Thanks to everyone who found bugs, initiated PR, replied to questions, and wrote documentation! Special thanks to the two community partners [`@xiaohuoni`](https://github.com/xiaohuoni) [`@imhele`](https://github.com/imhele), who have undertaken a large part of the v4 development work.

If you have any problems using Ant Design Pro, feel free to [submit a question](https://github.com/ant-design/ant-design-pro/issues) on GitHub.

Thank you for reading, please install and try. 🎉