Agent skill
preloading-resources
Teaches resource preloading APIs in React 19 including prefetchDNS, preconnect, preload, and preinit. Use when optimizing initial load or navigation performance.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/preloading-resources
SKILL.md
Resource Preloading APIs
React 19 adds functions for optimizing resource loading.
Available Functions
import { prefetchDNS, preconnect, preload, preinit } from 'react-dom';
prefetchDNS
Perform DNS resolution early:
function App() {
prefetchDNS('https://api.example.com');
prefetchDNS('https://cdn.example.com');
return <div>App content</div>;
}
preconnect
Establish connection before needed:
function App() {
preconnect('https://api.example.com');
return <div>App content</div>;
}
preload
Preload resources without executing:
function App() {
preload('/font.woff2', { as: 'font', type: 'font/woff2', crossOrigin: 'anonymous' });
preload('/hero-image.jpg', { as: 'image' });
preload('/critical.css', { as: 'style' });
return <div>App content</div>;
}
preinit
Preload and execute resource:
function App() {
preinit('/critical.js', { as: 'script' });
preinit('/critical.css', { as: 'style', precedence: 'high' });
return <div>App content</div>;
}
Use Cases
On Route Hover:
function NavLink({ to, children }) {
const handleMouseEnter = () => {
preload(`/api/data${to}`, { as: 'fetch' });
preinit(`/routes${to}.js`, { as: 'script' });
};
return (
<Link to={to} onMouseEnter={handleMouseEnter}>
{children}
</Link>
);
}
For comprehensive preloading documentation, see: research/react-19-comprehensive.md lines 811-834.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?