How to use the react-is.isSuspense function in react-is

To help you get started, we’ve selected a few react-is 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 / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
isCustomComponent(type) {
    const fakeElement = makeFakeElement(type);
    return !!type && (
      typeof type === 'function'
      || isForwardRef(fakeElement)
      || isContextProvider(fakeElement)
      || isContextConsumer(fakeElement)
      || isSuspense(fakeElement)
    );
  }
github airbnb / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
const Provider = adapter.getProviderFromConsumer(el.type);
          const value = providerValues.has(Provider)
            ? providerValues.get(Provider)
            : getProviderDefaultValue(Provider);
          const MockConsumer = Object.assign(
            (props) => props.children(value),
            el.type,
          );
          return withSetStateAllowed(() => renderer.render({ ...el, type: MockConsumer }));
        } else {
          isDOM = false;
          let renderedEl = el;
          if (isLazy(renderedEl)) {
            throw TypeError('`React.lazy` is not supported by shallow rendering.');
          }
          if (isSuspense(renderedEl)) {
            let { children } = renderedEl.props;
            if (suspenseFallback) {
              const { fallback } = renderedEl.props;
              children = replaceLazyWithFallback(children, fallback);
            }
            const FakeSuspenseWrapper = () => children;
            renderedEl = React.createElement(FakeSuspenseWrapper, null, children);
          }
          const { type: Component } = renderedEl;

          const context = getMaskedContext(Component.contextTypes, unmaskedContext);

          if (isMemo(el.type)) {
            const { type: InnerComp, compare } = el.type;

            return withSetStateAllowed(() => renderer.render(