Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');
}
}