react with class code example
Example 1: create-react-app class component
npx create-react-app my-app --scripts-version react-scripts@2.1.7
Example 2: how to use a js class in react
class Developer { constructor(firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } getName() { return this.firstname + ' ' + this.lastname; }} class ReactDeveloper extends Developer { getJob() { return 'React Developer'; }} var me = new ReactDeveloper('Robin', 'Wieruch'); console.log(me.getName());console.log(me.getJob());