--- title: React useScript hook type: snippet tags: [hooks,effect,state,event] author: chalarangelo cover: travel-mug-3 dateModified: 2021-10-08T05:00:00-04:00 --- Dynamically loads an external script. - Use the `useState()` hook to create a state variable for the load status of the script. - Use the `useEffect()` hook to handle all the logic for loading and unloading the script anytime the `src` changes. - If no `src` value is present, set the `status` to `'idle'` and return. - Use `Document.querySelector()` to check if a `