Get started with create-react-class CDN

MIT licensed

Create React Class is a library for creating React components as ES6 classes.

Tags:
  • react

Stable version

Copied!

How to start using create-react-class CDN


import React from 'react';
import createReactClass from 'create-react-class';

const MyComponent = createReactClass({
  displayName: 'MyComponent',

  getInitialState() {
    return { count: 0 };
  },

  handleClick() {
    this.setState({ count: this.state.count + 1 });
  },

  render() {
    return (
      <div>
        <button onClick={this.handleClick}>Click me!</button>
        <p>Count: {this.state.count}</p>
      </div>
    );
  }
});

export default MyComponent;
Copied!
Copied!

All versions