0 votes
in ReactJS by
What is React.createClass?

1 Answer

0 votes
by

React.createClass allows us to generate component “classes.” But with ES6,

React allows us to implement component classes that use ES6 JavaScript

classes. The end result is the same — we have a component class. But the

style is different. And one is using a “custom” JavaScript class system

(createClass) while the other is using a “native” JavaScript class system.

React JS Interview Question

When using React’s createClass() method, we pass in an object as an argument.

So we can write a component using createClass that looks like this:

React JS Interview Question

Using an ES6 class to write the same component is a little different. Instead of

using a method from the react library, we extend an ES6 class that the library

defines, Component.

Related questions

0 votes
0 votes
asked Dec 19, 2023 in ReactJS by john ganales
0 votes
0 votes
asked Dec 18, 2023 in ReactJS by rahuljain1
...