Skip to content

Instantly share code, notes, and snippets.

@jahilldev
Created August 29, 2024 20:09
Show Gist options
  • Save jahilldev/2bfb351c6e48a1dc5111ed1e99a72d54 to your computer and use it in GitHub Desktop.
Save jahilldev/2bfb351c6e48a1dc5111ed1e99a72d54 to your computer and use it in GitHub Desktop.
React Third Party - Component to render container for third party rendered HTML markup
/**
- This is undocumented behaviour, and works as of React 16.x
- Any HTML rendered within this <div /> will not be wiped by React
- For example, an advert provider can output markup to this container without React removing on re-render
*/
function ReactThirdParty() {
return (
<div
dangerouslySetInnerHTML={{ __html: '' }}
suppressHydrationWarning
/>
);
}
@jahilldev
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment