mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
29 lines
459 B
Markdown
29 lines
459 B
Markdown
# `useCss`
|
|
|
|
React side-effect hook that changes [CSS dynamically][gen-5].
|
|
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import {useCss} from 'react-use';
|
|
|
|
const Demo = () => {
|
|
const className = useCss({
|
|
color: 'red',
|
|
border: '1px solid red',
|
|
'&:hover': {
|
|
color: 'blue',
|
|
},
|
|
});
|
|
|
|
return (
|
|
<div className={className}>
|
|
Hover me!
|
|
</div>
|
|
);
|
|
};
|
|
```
|
|
|
|
[gen-5]: https://github.com/streamich/freestyler/blob/master/docs/en/generations.md#5th-generation
|