File: use-stderr.md | Updated: 11/16/2025
useStderr is a React hook that exposes the stderr stream.
import {useStderr} from 'ink';
const Example = () => {
const {stderr} = useStderr();
return …
};
Type: stream.Writable
Default: process.stderr
Stderr stream.
Write any string to stderr while preserving Ink's output.
It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two.
It's similar to <Static>, except it can't accept components; it only works with strings.
Type: string
Data to write to stderr.
import {useStderr} from 'ink';
const Example = () => {
const {write} = useStderr();
useEffect(() => {
// Write a single message to stderr, above Ink's output
write('Hello from Ink to stderr\n');
}, []);
return …
};