I am trying to migrate from PropTypes
to Flow
type checking in my React ponents.
Please what is the equivalent of PropTypes.func
in Flow
, to specify that a prop is a Function ?
My code looks like this:
import * as React from 'react'
type Props = {
doSomething: /* function */
}
class MyComponent extends React.Component<Props> {}
I am trying to migrate from PropTypes
to Flow
type checking in my React ponents.
Please what is the equivalent of PropTypes.func
in Flow
, to specify that a prop is a Function ?
My code looks like this:
import * as React from 'react'
type Props = {
doSomething: /* function */
}
class MyComponent extends React.Component<Props> {}
Share
Improve this question
asked Jan 15, 2018 at 12:57
acmouneacmoune
3,4235 gold badges31 silver badges53 bronze badges
2 Answers
Reset to default 14You can use:
type Props = {
doSomething: () => void,
}
or specify arguments if needed.
There is a clearer way:
type Props = {
doSomething: Function // with capital letter
}