rofrischmann/react-css-component

View on GitHub
src/utils/appendStyle.js

Summary

Maintainability
A
0 mins
Test Coverage
export default function appendStyle(id, css) {
  if (!document.head.querySelector('#' + id)) {
    const node = document.createElement('style')
    node.textContent = css
    node.type = 'text/css'
    node.id = id

    document.head.appendChild(node)
  }
}