Using React v16.13.1 I have the following component class with a Material-UI Button component and a RefObject to access the button element.
class Search extends React.Component<any, any>{
constructor(props: any) {
super(props)
this.streetViewRef = React.createRef();
}
private streetViewRef: React.RefObject<Button>;
}
for the following Button element
<Button ref={this.streetViewRef} size="sm" variant="primary" block >Street View</Button>
However, the following TypeScript error is displayed.
What needs to be changed to correct this error?
forwardRef
so the ref type isReact.RefObject<HTMLButtonElement>
but I'm not sure, that error message is not very clear, otherwise you probably wouldn't need to ask :)