Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 458 Bytes

useCss.md

File metadata and controls

27 lines (21 loc) · 458 Bytes

useCss

React 副作用钩子,用于 CSS 动态 改变。

用法

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>
  );
};