David Boyne

Technical Lead @Comparethemarket. Organiser of Agile-Peterborough. Speaker & evangelist of JavaScript, Agile Principles and helping others.

React.createClass vs extends React.Component

React.createComponent and extends React.Component give us the same results. The ability to create React components.

I’m starting a new project, and wanted to set a standard in the way I create components. I was interested to see who uses React.createComponent or extends React.Component.

Looks like the majority of people that answered are using extends React.Component.

I done some deeper diving into why and found some links that might help you decide:

Composing Components

Choose extends React.Component

I decided to use extends React.Component due to the fact it looks like Facebook might be dropping it at some point (although that was over a year ago…). Thanks to @Rhodesy for pointing this out.

SHARE