Is it a good practice to create base components and then extend them in React?
<p>I'm just learning React and I am writing components using ES7 syntax.
My idea is to create a base component which will contain some methods that I want all derived components to have. For example, I want to implement <a href="https://facebook.github.io/react/docs/two-way-binding-helpers.html#reactlink-without-linkedstatemixin">valueLink without the mixin</a>, for two-way binding in all my components. Here is my idea:</p>

<pre><code>class MyComponent extends React.Component {

    bindTwoWay(name) {
        return {
            value: this.state[name],
            requestChange: (value) =&gt; {
                this.setState({[name]: value})
            }
        }
    };
}
</code></pre>

<p>&nbsp;</p>

<pre><code>class TextBox extends MyComponent {
    state = {
        val: ''
    };

    render() {
        return (&lt;div&gt;
            &lt;input valueLink={this.bindTwoWay('val')}/&gt;
            &lt;div&gt;You typed: {this.state.val}&lt;/div&gt;
        &lt;/div&gt;)
    }
}
</code></pre>

<p>And it works just fine. However, I wasn't able to find much information about this method. It's not about valueLink, that was just an example. The idea is to have some methods in a base component and later extend that component so that derived components have all those methods, like the usual OOP way. So I would just like to know if this is perfectly fine or there are some flaws that I am not aware of. Thanks.</p>