useCssVar ​
Hook that returns the value of a CSS variable
typescript
import { useCssVar } from '@siberiacancode/reactuse';
Usage ​
typescript
const { value, set } = useCssVar('color', 'red');
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
key | string | - | The CSS variable key |
initialValue | string | - | The initial value of the CSS variable |
Returns
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | The target element |
key | string | - | The CSS variable key |
initialValue | string | - | The initial value of the CSS variable |