Created
May 4, 2015 12:03
-
-
Save oskardahlberg/742103262d2217046a5b to your computer and use it in GitHub Desktop.
react css injection pseudo
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
function styler(...args) { | |
var result = { className: '', style: {} }; | |
args.forEach(arg => { | |
var reference = getReference(arg); | |
var injected = reference && isInjected(reference); | |
if (!injected) { | |
Object.assign(style, arg); | |
if (reference) injectStyle(reference); | |
} | |
else className += ' ' + getClassName(arg); | |
}); | |
return result; | |
}; | |
<Component {...styler({ color: 'red' }, styleMixin(), styleRef)} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment