I am trying to migrate from PropTypes
to Flow
type checking in my React components.
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> {}
You can use:
type Props = {
doSomething: () => void,
}
or specify arguments if needed.
There is a clearer way:
type Props = {
doSomething: Function // with capital letter
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With