DEV Community

Nwanguma Victor
Nwanguma Victor

Posted on

2 1

The Class Property Proposal is Finished and Avaliable in React

Hooray! The class property proposal is finished and is avaliable via babel/plugin-proposal-class-properties

This plugin is included in @babel/preset-env, in ES2022

Check it out here

So you can finally clean that legacy React project in peace

class Foo extends React.Component {
  // Note: this syntax is now standardized.
  handleClick = () => {
    console.log('Click happened');
  }
  render() {
    return <button onClick={this.handleClick}>Click Me</button>;
  }
}

Enter fullscreen mode Exit fullscreen mode

Spread the word!

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay