@kne/use-css-variables

0.1.1 • Public • Published

useCssVariables

css-variables的react的hooks

npm i @kne/use-css-variables

使用示例

const Component = ()=>{
    const [height,setHeight] = useState({componentHeight:'40px'});
    useCssVariables(height);
    return (
        <div className="component" onClick={()=>{
            setHeight({
                componentHeight:'100px'
            });
        }}>按钮</div>
    );
};
.component{
    height:var(--componentHeight);
}

API

change log:

Package Sidebar

Install

npm i @kne/use-css-variables

Weekly Downloads

4

Version

0.1.1

License

ISC

Unpacked Size

34.7 kB

Total Files

13

Last publish

Collaborators

  • metacoo
  • yangwang123456
  • juliewang
  • lingtong