File: use-app.md | Updated: 11/16/2025
useApp is a React hook that exposes a method to manually exit the app (unmount).
import {useApp} from 'ink';
const Example = () => {
const {exit} = useApp();
// Exit the app after 5 seconds
useEffect(() => {
setTimeout(() => {
exit();
}, 5000);
}, []);
return …
};
Type: Function
Exit (unmount) the whole Ink app.
Type: Error
Optional error. If passed, waitUntilExit will reject with that error.