
package.dist.utils.use-effect-once.cjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react Show documentation
Show all versions of react Show documentation
A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.
The newest version!
'use client';
'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const react = require('react');
const useEffectOnce = (cb) => {
const savedCallback = react.useRef(cb);
const effectGuard = react.useRef(false);
react.useEffect(() => {
savedCallback.current = cb;
});
react.useEffect(() => {
if (effectGuard.current !== true) {
effectGuard.current = true;
savedCallback.current();
}
}, []);
};
exports.useEffectOnce = useEffectOnce;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy