mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 03:34:26 +03:00
489 B
489 B
noop
A no-operation function that does nothing. This can be used as a placeholder or default function.
Signature
function noop(): void;
Returns
(void
): This function does not return anything.
Examples
import { noop } from 'es-toolkit/function';
interface Props {
onChange?: () => void;
}
function MyComponent({ onChange = noop }: Props) {
// Here onChange is guaranteed to be a function, so it's safe to call.
onChange();
}