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

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}
      />
    );
  }
}