📄 ink/hooks/use-app

File: use-app.md | Updated: 11/16/2025

useApp

useApp is a React hook that exposes a method to manually exit the app (unmount).

Usage

import {useApp} from 'ink';

const Example = () => {
	const {exit} = useApp();

	// Exit the app after 5 seconds
	useEffect(() => {
		setTimeout(() => {
			exit();
		}, 5000);
	}, []);

	return …
};

API

exit(error?)

Type: Function

Exit (unmount) the whole Ink app.

error

Type: Error

Optional error. If passed, waitUntilExit will reject with that error.