Skip to main content

Basic Example

In order to use the useScript hook in your components you need to provide the following:

  • A unique key to identify the script
  • A defined strategy that you want your script to be loaded with
  • The source/url of the script as src property

Use useScript hook inside of a component

function HomePage() {
useScript({
id: 'INSTAGRAM-01',
strategy: ScriptStrategy.AFTER_INTERACTIVE,
src: 'https://www.instagram.com/embed.js'
});

return <HomePageTemplate/>;
}