How to use the styletron-legacy.injectOnce function in styletron-legacy

To help you get started, we’ve selected a few styletron-legacy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github styletron / styletron / packages / demo-fixtures / compat.js View on Github external
function CompatComponent(props, context) {
  if (context.styletron) {
    var styleName = context.styletron.injectDeclaration({prop: 'color', val: 'red'});
    return React.createElement('div',
      {className: styleName}, 'I am a compat component');
  } else {
    styletronLegacy.injectOnce('.compatStyle { color: red }', '__compat_style__');
    return React.createElement('div',
      {className: 'compatStyle'}, 'I am a compat component');
  }
}

styletron-legacy

Legacy package for 1.x styletron

MIT
Latest version published 7 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages