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