Use es6 class style in demo code
See original GitHub issue2.7.1 版 Ant Design 文档:https://ant.design/docs/react/introduce-cn
文档的示例代码,针对React有状态组件分别使用了两种不同的定义组件的方式。
在大多数情况下 ,比如Modal的示例代码,采用了
const App = React.createClass({})
上面那样的写法。
而在steps,slider 等组件的示例代码中,又出现了
class Demo extends React.Component {}
这样的写法
我不知道出现这两种定义组件的方式的用意何在?
我当然知道这样一个庞大的项目,文档绝对不可能是一个人写成的,但还是希望能够统一一下定义组件的方式。看React的官方文档,目前官方应该是推荐使用第二种定义组件的方式的。
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:8 (7 by maintainers)
Top Results From Across the Web
6.2: Classes in JavaScript with ES6 - p5.js Tutorial - YouTube
This video introduces Object-Oriented Programming in JavaScript with ES6 classes and the p5.js library. Code : ...
Read more >Javascript: Introduction to ES6 classes | by Abdul Kadir
Let's look at an example class created with the ES6 syntax: ... The above example uses a constructor function and the properties 'name'...
Read more >As a JS Developer, This Is What Keeps Me Up at Night - Toptal
The answer here is there isn't one. These do effectively the same thing, it's only a question of whether ES6 class syntax was...
Read more >Building web components using ES6 classes - Polymer Project
Custom elements can be defined from an ES6 class by extending the HTMLElement DOM interface: 'use strict'; class StockTicker extends HTMLElement ...
Read more >Classes - JavaScript - MDN Web Docs
Classes are a template for creating objects. They encapsulate data with code to work on that data. Classes in JS are built on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
All done!! 🎆 🎉
Thanks everybody!!!
Anyone could propose PR for
React.createClass => React.Component
and check this list after merging.