Skip to content

noop ​

A no-operation function that does nothing. This can be used as a placeholder or default function.

Signature ​

typescript
function noop(): void;

Returns ​

(void): This function does not return anything.

Examples ​

typescript
import { 
noop
} from 'js-utils-es/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
();
}

Source ​

Source • Docs • Test Case

Contributors ​

Changelog ​

No recent changes

Made with ❤️