@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
19 lines (17 loc) • 704 B
JavaScript
import { useUpdateEffect } from "../../utils/effect.js";
import { useBreakpoint } from "./use-breakpoint.js";
//#region src/hooks/use-breakpoint/use-update-breakpoint-effect.ts
/**
* `useUpdateBreakpointEffect` is a custom hook that skips the side effect on the initial render and executes a specific callback function when the breakpoint changes.
*
* @see https://yamada-ui.com/docs/hooks/use-update-breakpoint-effect
*/
const useUpdateBreakpointEffect = (callback, deps) => {
const breakpoint = useBreakpoint();
useUpdateEffect(() => {
callback(breakpoint);
}, [breakpoint, ...deps]);
};
//#endregion
export { useUpdateBreakpointEffect };
//# sourceMappingURL=use-update-breakpoint-effect.js.map