Code embed component in React / Next?

So one of my colleagues came to me with this requirement. He wanted
to create a code embed component in the React (NextJS) app that he was
working on. Initially, he had used the dangerouslySetInnerHTML attribute to set the inner HTML to the embed code (unsanitized!!)....