Skip to content

Commit

Permalink
GitBook: [#18] No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej authored and gitbook-bot committed Jan 23, 2022
1 parent 73ce2f5 commit b84d694
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,6 @@ description: Start using TSS, with or without MUI
yarn add tss-react @emotion/react
```

`./MyComponent.tsx`

```tsx
import { makeStyles } from "./makeStyles";

export function MyComponent(props: Props) {
const { className } = props;

const [color, setColor] = useState<"red" | "blue">("red");

const { classes, cx } = useStyles({ color });

//Thanks to cx, className will take priority over classes.root 🤩
return <span className={cx(classes.root, className)}>hello world</span>;
}

const useStyles = makeStyles<{ color: "red" | "blue" }>()(
(theme, { color }) => ({
"root": {
color,
"&:hover": {
"backgroundColor": theme.primaryColor
}
}
})
);
```

{% tabs %}
{% tab title="With MUI" %}
{% hint style="info" %}
Expand Down Expand Up @@ -108,6 +80,7 @@ export function MyComponent(props: Props) {
const { classes, cx } = useStyles({ color });

//Thanks to cx, className will take priority over classes.root 🤩
//With TSS you must stop using clsx and use cx instead.
return <span className={cx(classes.root, className)}>hello world</span>;
}

Expand Down

0 comments on commit b84d694

Please sign in to comment.