babel-plugin-infer-extends-componentdeprecated

Automatically extends React.Component for classes that include render method

Usage no npm install needed!

<script type="module">
  import babelPluginInferExtendsComponent from 'https://cdn.skypack.dev/babel-plugin-infer-extends-component';
</script>

README

infer-extends-component

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

Install

npm install --save-dev babel-plugin-infer-extends-component

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.