How to use the @airbnb/lunar/lib/utils/renderElementOrFunction function in @airbnb/lunar

To help you get started, we’ve selected a few @airbnb/lunar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airbnb / lunar / packages / apollo / src / components / Mutation / index.tsx View on Github external
private handleRender = (mutator: MutationFunction, result: MutationResult<data>) =&gt; {
    if (result.loading) {
      return renderElementOrFunction(this.props.loading) || ;
    }

    if (result.error &amp;&amp; (!this.props.ignoreGraphQLErrors || result.error.networkError)) {
      // istanbul ignore next (need to fix tests)
      return (
        renderElementOrFunction(this.props.error, result.error) || (
          
        )
      );
    }

    return this.props.children(mutator, result);
  };
</data>
github airbnb / lunar / packages / apollo / src / components / Mutation / index.tsx View on Github external
private handleRender = (mutator: MutationFunction, result: MutationResult<data>) =&gt; {
    if (result.loading) {
      return renderElementOrFunction(this.props.loading) || ;
    }

    if (result.error &amp;&amp; (!this.props.ignoreGraphQLErrors || result.error.networkError)) {
      // istanbul ignore next (need to fix tests)
      return (
        renderElementOrFunction(this.props.error, result.error) || (
          
        )
      );
    }

    return this.props.children(mutator, result);
  };
</data>
github airbnb / lunar / packages / apollo / src / components / Query / index.tsx View on Github external
private handleRender = (result: QueryResult) =&gt; {
    if (result.loading) {
      return renderElementOrFunction(this.props.loading) || ;
    }

    if (result.error &amp;&amp; (!this.props.ignoreGraphQLErrors || result.error.networkError)) {
      return (
        renderElementOrFunction(this.props.error, result.error) || (
          
        )
      );
    }

    return this.props.children(result.data || null, result);
  };
github airbnb / lunar / packages / apollo / src / components / Query / index.tsx View on Github external
private handleRender = (result: QueryResult) =&gt; {
    if (result.loading) {
      return renderElementOrFunction(this.props.loading) || ;
    }

    if (result.error &amp;&amp; (!this.props.ignoreGraphQLErrors || result.error.networkError)) {
      return (
        renderElementOrFunction(this.props.error, result.error) || (
          
        )
      );
    }

    return this.props.children(result.data || null, result);
  };