
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
@custom-react-hooks/use-island
Advanced tools
A React hook for implementing island architecture with selective hydration, allowing you to optimize performance by hydrating components only when needed.
npm install @custom-react-hooks/use-island
import React from 'react';
import { useIsland } from '@custom-react-hooks/use-island';
function MyIslandComponent() {
const { isHydrated, isVisible, hydrate, dehydrate } = useIsland('my-island');
return (
<div>
<p>Hydrated: {isHydrated ? 'Yes' : 'No'}</p>
<p>Visible: {isVisible ? 'Yes' : 'No'}</p>
<button onClick={hydrate}>Hydrate</button>
<button onClick={dehydrate}>Dehydrate</button>
</div>
);
}
import React from 'react';
import { useIsland } from '@custom-react-hooks/use-island';
function HighPriorityIsland() {
const { isHydrated, hydrate } = useIsland('critical-island', {
priority: 'high',
lazy: false
});
return (
<div>
{isHydrated ? (
<ExpensiveComponent />
) : (
<div>Loading...</div>
)}
</div>
);
}
import React from 'react';
import { useIsland } from '@custom-react-hooks/use-island';
function CallbackIsland() {
const { isHydrated, hydrate } = useIsland('callback-island', {
onHydrate: (islandId) => {
console.log(`Island ${islandId} hydrated`);
// Analytics, logging, etc.
},
onDehydrate: (islandId) => {
console.log(`Island ${islandId} dehydrated`);
}
});
return (
<div>
<button onClick={hydrate}>
{isHydrated ? 'Hydrated' : 'Hydrate Island'}
</button>
</div>
);
}
import React from 'react';
import { useIsland } from '@custom-react-hooks/use-island';
function LazyIsland() {
const { isHydrated, isVisible } = useIsland('lazy-island', {
lazy: true,
priority: 'low'
});
return (
<div>
{isHydrated ? (
<HeavyComponent />
) : (
<PlaceholderComponent />
)}
</div>
);
}
string): Unique identifier for the islandIslandOptions, optional): Configuration optionsinterface IslandOptions {
priority?: 'high' | 'normal' | 'low';
lazy?: boolean;
onHydrate?: (islandId: string) => void;
onDehydrate?: (islandId: string) => void;
}
interface IslandState {
isHydrated: boolean;
isVisible: boolean;
hydrate: () => void;
dehydrate: () => void;
}
boolean): Whether the island is currently hydratedboolean): Whether the island is visible in viewportfunction): Function to hydrate the islandfunction): Function to dehydrate the islandThis hook is written in TypeScript and provides full type safety:
import { useIsland, IslandOptions, IslandState } from '@custom-react-hooks/use-island';
const options: IslandOptions = {
priority: 'high',
lazy: false
};
const island: IslandState = useIsland('my-island', options);
MIT © Bane Grozdanovic
FAQs
A React hook for island architecture and selective hydration
The npm package @custom-react-hooks/use-island receives a total of 105 weekly downloads. As such, @custom-react-hooks/use-island popularity was classified as not popular.
We found that @custom-react-hooks/use-island demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.