Relay.PropTypes

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

© 2013–present Facebook Inc.
Licensed under the BSD License.
https://facebook.github.io/relay/docs/api-reference-relay-proptypes.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部