Skip to content

Commit

Permalink
[docs] What's the clsx dependency for?
Browse files Browse the repository at this point in the history
This is the most frequest query on Algolia with no results (0.05%).
I guess we have reached a point where we can start to ignore these metric :)
  • Loading branch information
oliviertassinari committed Sep 4, 2019
1 parent 2eb5f81 commit c5e45cd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/src/pages/getting-started/faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,32 @@ function App() {
);
}
```

## What's the clsx dependency for?

[clsx](https://github.com/lukeed/clsx) is a tiny utility for constructing `className` strings conditionally.

Instead of writing:

```jsx
return (
<div
className={`MuiButton-root ${disabled ? 'Mui-disabled' : ''} ${selected ? 'Mui-selected' : ''}`}
/>
);
```

you can do:

```jsx
import clsx from 'clsx';

return (
<div
className={clsx('MuiButton-root', {
'Mui-disabled': disabled,
'Mui-selected': selected,
})}
/>
);
```

0 comments on commit c5e45cd

Please sign in to comment.