
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
react-lazy-hydration-render
Advanced tools
React lazy hydration render. Small library to improve hydration performance in SSR apps. It is based on a lazy hydration approach.
Small library to improve hydration performance in SSR apps. It is based on a lazy hydration approach.
npm i --save react-lazy-hydration-render
or
yarn add react-lazy-hydration-render
This library is using IntersectionObserver API. if you need to support older browsers, you should install intersection-observer polyfill in order for it to work.
Component is activated when user scrolls to it.
import React from 'react';
import { LazyRender } from 'react-lazy-hydration-render';
const HeavyHeader = () => <header>1</header>;
export const Header = () => (
<LazyRender>
<HeavyHeader />
</LazyRender>
);
You can configure the wrapper component.
import React from 'react';
import { LazyRender } from 'react-lazy-hydration-render';
const HeavyHeader = () => <header>1</header>;
export const Header = () => (
<LazyRender wrapper="p" wrapperProps={{ style: { margin: '10px' } }}>
<HeavyHeader />
</LazyRender>
);
import React from 'react';
import { LazyRender, createUseObserverVisible } from 'react-lazy-hydration-render';
const useObserverVisible = createUseObserverVisible({
rootMargin: '0px',
threshold: 1.0,
});
const HeavyHeader = () => <header>1</header>;
export const Header = () => (
<LazyRender useObserver={useObserverVisible}>
<HeavyHeader />
</LazyRender>
);
Package supports changing a loading mechanics. For example, component could be activated on click.
import React, { useEffect, useState } from 'react';
import { LazyRender } from 'react-lazy-hydration-render';
const isServer = typeof window === 'undefined';
const useClickActivated = (ref) => {
const [isVisible, changeVisibility] = useState(isServer);
useEffect(() => {
if (!ref.current || isVisible) {
return;
}
ref.current.addEventListener('click', () => changeVisibility(true));
}, [ref]);
return isVisible;
};
const HeavyHeader = () => <header>1</header>;
export const Header = () => (
<LazyRender useObserver={useClickActivated}>
<HeavyHeader />
</LazyRender>
);
FAQs
React lazy hydration render. Small library to improve hydration performance in SSR apps. It is based on a lazy hydration approach.
We found that react-lazy-hydration-render demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.