i-like-robots / hyperons

🔥 The fastest JSX to string renderer on the server and in the browser.
https://www.npmjs.com/package/hyperons
MIT License
45 stars 4 forks source link

Class constructor #18

Closed i-like-robots closed 6 years ago

i-like-robots commented 6 years ago

This adds a base class constructor for consistency with other frameworks and better capability to render components originally authored for other frameworks.

Usage:

import { h, Component } from 'hyperons'

class MyComponent extends Component {
  render() {
    return <h1>Hello, {this.props.name}</h1>;
  }
}
coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.02%) to 96.341% when pulling eb06f9d163107e44881b196da91675864bba3ab4 on class-constructor into 6707baa31f22942cf626deb7c43b64c11e6a7071 on master.

kavanagh commented 6 years ago

I'm not sure when I'd use it.

Has this been asked for? What problem does it solve?

i-like-robots commented 6 years ago

I'm not sure when I'd use it.

Hopefully never! Some folks opt to use classes for consistency, or you may be trying to consume an expected class component in which case this should "just work".