Open tizmagik opened 7 years ago
This is awesome! Cool idea of unmounting styles when the component unmounts. I might need to update docs with an ecosystem section...
Yea, the only issue is that it doesn't currently include the "extended" styles, which I would expect as a user of react-csjs
given the API it allows. See https://github.com/rtsao/csjs/issues/51
Any pointers on how to achieve that for react-csjs
? I guess I could hold on to a singleton instance of csjs
internally in the module, but there would be an issue with styles rendered "outside" of react-csjs
s control. Is this the pattern you'd recommend, or is there some other way? Maybe also exposing the csjs
singleton as a named export as part of the API would be good, too:
import withStyles, {csjs} from 'react-csjs';
Where csjs
is the singleton. Not sure if that actually helps or adds confusion though...
I don't know if this is helpful or not, but in comparing the various CSS in JS techniques, I stumbled across csjs, Aphrodite and JSS. I liked the interface that
react-jss
allows and noticed there wasn't an equivalent HoC for csjs.So I've written one: react-csjs.
The initial implementation is admittedly very basic and bare-bones, but it provided enough utility for me that I figured it may help others and I decided to publish it. Let me know your thoughts -- happy to improve/change things around in any way you see fit.
Thanks!