Loading...
function Chart() {
preinit('/styles/chart.css', { as: 'style' });
return <canvas />;
}function Chart() {
preinit('/styles/chart.css', { as: 'style', precedence: 'medium' });
return <canvas />;
}Stylesheets need precedence, which tells React where to insert them relative to other stylesheets on the page.
preinit is used only for scripts and stylesheets that should run now, with as set to 'script' or 'style'.preinit set precedence so they are inserted in a stable order.preload instead.Yes. preinit with as: 'script' downloads and runs the script as soon as it is ready, like an async script tag.
Yes. Use preinitModule for module scripts, and preloadModule when the module should only be downloaded.