You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to validate the children of an element that's passed as children.
For example:
<x><y/></x>
Where y is wrapped with injectIntl and, so I want to check in x that y is either of type "A" or type "B", but because it's wrapped, I need to go one level deep.
Is there a way to do this with these proptypes?
childrenOfType doesn't help because it can only check if it's of type injectIntl.
The text was updated successfully, but these errors were encountered:
class Foo extends Component {
};
...
export default injectIntl(Foo);
Bar:
export default class Bar extends Component {
render() {
const Foo = this.props.foo;
return <Foo />;
}
}
FormDropZoneWrapper.propTypes = {
dropZoneComponent: PropTypes.func.isRequired, // I want here to validate that Foo is actually Foo and not some other component, but it's wrapped by intl so I can't
};
In that case, you'd use PropTypes.oneOf([Foo]) - iow, nobody can ever get at the unwrapped Foo, only the wrapped one, so you only have to validate that it's the wrapped one.
I want to validate the children of an element that's passed as children.
For example:
Where y is wrapped with injectIntl and, so I want to check in
x
that y is either of type "A" or type "B", but because it's wrapped, I need to go one level deep.Is there a way to do this with these proptypes?
childrenOfType
doesn't help because it can only check if it's of type injectIntl.The text was updated successfully, but these errors were encountered: