airbnb / react-with-styles

Use CSS-in-JavaScript with themes for React without being tightly coupled to one implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

confusion about modules

fsjoyti opened this issue · comments

Hi I would like to use react-with-styles for one of my project but I am confused on what it means by modules is it supposed to be a css file ? When I tried to do this in a CSS file my compiler shows me errors
airbnbreactstyles

Hi @fsjoyti! Thanks for your interest. This is not meant to be used in CSS files. Rather, it is a project to help you write CSS in JavaScript. Here's a more complete example, all contained in the same JSX file:

function Foo({ styles }) {
  return (
    <div {...css(styles.foo)}>
      Foo
    </div>
  );
}

export default withStyles(() => {
  foo: {
    color: 'red',
  },
})(Foo);

I hope this helps!