@phenomenon-hooks/use-set-global-custom-property
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

useSetGlobalCustomProperty


Installation

yarn add @phenomenon-hooks/use-set-global-custom-property

or

npm i @phenomenon-hooks/use-set-global-custom-property

Usage

import React from 'react';
import { useSetGlobalCustomProperty } from '@phenomenon-hooks/use-set-global-custom-property';

const Component: React.FC = () => {
    const setGlobalCustomProperty = useSetGlobalCustomProperty();

    return (
        <div style={{ backgroundColor: 'var(--color)' }}>
            <button
                onClick={() => {
                    setGlobalCustomProperty('--color', 'red');
                }}
            >
                Set global custom property
            </button>
        </div>
    );
};

Anatomy

const setGlobalCustomProperty = useSetGlobalCustomProperty();

setGlobalCustomProperty('--color', 'red');

Returns

Return value Type Description
setGlobalCustomProperty function Function that will set global custom property. (e.g. --color: red;)

Readme

Keywords

none

Package Sidebar

Install

npm i @phenomenon-hooks/use-set-global-custom-property

Weekly Downloads

3

Version

0.0.2

License

MIT

Unpacked Size

5.39 kB

Total Files

8

Last publish

Collaborators

  • mykola.kolomoyets