How to use the @shopify/react-hydrate.useHydrationManager function in @shopify/react-hydrate

To help you get started, we’ve selected a few @shopify/react-hydrate 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 Shopify / quilt / packages / react-async / src / component.tsx View on Github external
function Async(props: Props) {
    const {resolved: Component, load, loading, error} = useAsync(resolver, {
      scripts: scriptTiming,
      styles: stylesTiming,
      immediate: !deferred,
    });

    const {current: startedHydrated} = useRef(useHydrationManager().hydrated);

    if (error) {
      return renderError(error);
    }

    let loadingMarkup: ReactNode | null = null;

    if (progressivelyHydrated && !startedHydrated) {
      loadingMarkup = (
        
      );
    } else if (loading) {
      loadingMarkup = ;
    }

    let contentMarkup: ReactNode | null = null;

@shopify/react-hydrate

Utilities for hydrating server-rendered React apps

MIT
Latest version published 5 months ago

Package Health Score

62 / 100
Full package analysis