question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use es6 class style in demo code

See original GitHub issue

2.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:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
afc163commented, Feb 20, 2017

All done!! 🎆 🎉

Thanks everybody!!!

3reactions
afc163commented, Feb 20, 2017
  • affix
  • alert
  • anchor
  • auto-complete
  • back-top
  • badge
  • breadcrumb
  • button
  • calendar
  • card
  • carousel
  • cascader
  • checkbox
  • collapse
  • date-picker
  • dropdown
  • form
  • grid
  • input
  • input-number
  • layout
  • locale-provider
  • mention
  • menu
  • message
  • modal
  • notification
  • pagination
  • popconfirm
  • popover
  • progress
  • radio
  • rate
  • select
  • slider
  • spin
  • steps
  • switch
  • table
  • tabs
  • tag
  • time-picker
  • timeline
  • tooltip
  • transfer
  • tree
  • tree-select
  • upload

Anyone could propose PR for React.createClass => React.Component and check this list after merging.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found