@expressive-react/babel-plugin-auto-extends

Automatically extends React.Component for classes that include an Expressive-recognized render method.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@expressive-react/babel-plugin-auto-extends
Minified + gzip package size for @expressive-react/babel-plugin-auto-extends in KB

Readme

babel-plugin-auto-extends

Automatically extends classes with React.Component that contain a render method.

Install

npm install --save-dev @expressive-react/babel-plugin-auto-extends

.babelrc

Note that babel infers babel-plugin

{
    "plugins": [
        "@expressive-react/auto-extends"
    ]
}

Before

import React from "react";

class FooBar {
    render(){
        return (
            <div>Hello World!</div>
        )
    }
}

After

import React from "react";

class FooBar extends React.Component {
    render(){
        return (
            <div>Hello World!</div>
        )
    }
}

Override

If you do not want to extend Component simply extending any other class will work. Classes extending undefined explicitely will not extend anything even if they would otherwise trigger the transform.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.