Skip to content

useConstructor #15

@Ruben-Arushanyan

Description

@Ruben-Arushanyan

Old version

import {
    useRef,
} from 'react';

const useConstructor = (constructor) => {
    const init = useRef(false);

    if (!init.current) {
        constructor();
        init.current = true;
    }
};

export {useConstructor};

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions