Created
March 10, 2018 00:51
-
-
Save kristoferbaxter/585a43e694772cef993f598a05f8ace1 to your computer and use it in GitHub Desktop.
This file contains 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
export class MyComponent extends React.Component { | |
componentWillMount() { | |
const styleid = 'MyComponentStyles' | |
if (document.head.querySelector(`#${styleid}`) !== null) { | |
const styles = document.createElement('style'); | |
styles.id = styleid; | |
styles.append('[foo]{ color: blue; }'); | |
document.head.appendChild(styles); | |
} | |
} | |
render() { | |
return ( | |
<div foo> | |
<p>Awesome</p> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment