Reputation: 116
This is how my child container declares Ownprops
export interface OwnProps {
prop1: string;
prop2: "callback function"
}
I will pass a callback function from parent to this child so that i can trigger the parent function from child.
I am not able to declare it in OwnProps.
I tried this
prop2: React.PropTypes.func
It gave error "React has no exported member PropTypes"
Upvotes: 1
Views: 291
Reputation: 53874
Do you mean you want to use callback types?
If your callback is of type () => void
:
interface OwnProps {
prop1: string;
prop2: () => void;
}
Upvotes: 1