Use destroySlots() to clean up ad slots that are no
longer needed (for example, when ad slot containers are removed due to a
component being unloaded).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],[],[],[],null,["# GPT and React\n\nThis sample showcases a basic single-page application (SPA) implementation\nutilizing Google Publisher Tag (GPT), [React](//react.dev/), and [Next.js](//nextjs.org/).\n\nSome important points to be aware of when working with GPT in SPAs:\n\n1. Ensure that GPT is only loaded once.\n2. Use [`disableInitialLoad()`](/publisher-tag/reference#googletag.PubAdsService_disableInitialLoad) and [`refresh()`](/publisher-tag/reference#googletag.PubAdsService_refresh) to control when ad requests are made. See [Control ad loading and refresh](/publisher-tag/guides/control-ad-loading) for details.\n3. Use [`setTargeting()`](/publisher-tag/reference#googletag.Slot_setTargeting) and [`clearTargeting()`](/publisher-tag/reference#googletag.Slot_clearTargeting) to control the targeting applied to ad slots. See [Key-value targeting](/publisher-tag/guides/key-value-targeting) for details.\n4. Use [`destroySlots()`](/publisher-tag/reference#googletag.destroySlots) to clean up ad slots that are no longer needed (for example, when ad slot containers are removed due to a component being unloaded).\n\n| **Note:** If you encounter any issues with the following embedded sample, try opening the [sample](//stackblitz.com/edit/gpt-react) in a new window. If the problem persists, click **Report an issue**.\n\nSample implementation\n---------------------\n\n[Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback%3A+integrations/react)"]]