I have two components, one which I'd like to inherit all class functions and state from the other, but update the render method. Is there a way to do this cleanly in React?
class A extends Component {
state = {
...
}
componentDidMount() {
this.setState({
...
});
}
changeText = (e) => {
this.setState({
text: e.target.value,
});
};
changeType = (e) => {
this.setState({
type: e.target.value,
});
};
...
}
class B extends Component {
render() {
...
}
}