Answer the question
In order to leave comments, you need to log in
[react + flow] What type to specify for a variable created by React.createRef()?
// @flow
import * as React from 'react';
class MyCrap extends React.Component<{}> {
myRef: any = React.createRef();
render() {
return <div ref={this.myRef}>Hello</div>;
}
}
// @flow
import * as React from 'react';
type Ref = {
current: any
}
class MyCrap extends React.Component<{}> {
myRef: Ref = React.createRef();
render() {
return <div ref={this.myRef}>Hello</div>;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question