Skip to content

Instantly share code, notes, and snippets.

@bzin
Created November 5, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzin/a348421f733ee177a943669956dcd6b9 to your computer and use it in GitHub Desktop.
Save bzin/a348421f733ee177a943669956dcd6b9 to your computer and use it in GitHub Desktop.
Create markup util for React dangerouslysetinnerhtml
/**
* Create markup for React dangerouslySetInnerHTML
* Read: https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
*
* @param text
* @returns {{__html: *}}
*/
const createMarkup = (html) => {
return {
__html: html || ''
}
}
export default createMarkup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment