Relay.PropTypes
Relay introduces two new classes of objects: RelayContainer
and Relay.Route
. Relay.PropTypes
provides prop validators used to assert that props are of these types.
Overview
Properties
-
static Container: ReactPropTypeValidator
A prop type validator asserting that a prop is a valid Relay container. -
static QueryConfig: ReactPropTypeValidator
A prop type validator asserting that a prop is a valid route.
Example
class MyApplication extends React.Component {
static propTypes = {
// Warns if `Component` is not a valid RelayContainer.
Component: Relay.PropTypes.Container.isRequired,
// Warns if `route` is not a valid route.
route: Relay.PropTypes.QueryConfig.isRequired,
};
render() {
return (
<Relay.RootContainer
Component={this.props.Component}
route={this.props.route}
/>
);
}
}