Podczas korzystania flowtype zdefiniować rekwizyt w context w ten sposóbjak można użyć typu flow do zdefiniowania podpory w kontekście reakcji komponentu?
// @flow
type MyType = Object;
class CustomView extends React.Component {
static childContextTypes = {
someProp: MyType
}
getChildContext() {
return {
someProp: this.props.someProp
};
}
}
mam następujący błąd:
CustomView: type specification of child context
someProps
is invalid; the type checker function must returnnull
or anError
but returned a object. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).
Więc jestem zmuszony do korzystania propTypes.object
zamiast Object
.