Created
November 5, 2020 13:34
-
-
Save bzin/a348421f733ee177a943669956dcd6b9 to your computer and use it in GitHub Desktop.
Create markup util for React dangerouslysetinnerhtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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