I'm trying to create a class with TypeScript that extends React.Component, but I'm having this error:
Class 'Provider' incorrectly extends base class 'Component<{}, {}>'.
Types of property 'render' are incompatible.
Type '(props: any) => any' is not assignable to type '() => false | Element'.
Here's the code:
import * as React from "react";
export default class Provider extends React.Component {
props;
getChildContext() {
const { children, ...context } = this.props;
return context;
}
render(props) {
const { children } = props;
return children[0];
}
}