import { useTask } from "@golem-sdk/react"; import type { TaskFunction, TaskExecutor } from "@golem-sdk/task-executor"; export function NodeVersionCheckTask({ executor }: { executor: TaskExecutor }) { const { isRunning, result, run, error } = useTask(executor); const getNodeVersionTask: TaskFunction = async (exe) => { return (await exe.run("node -v")).stdout?.toString() ?? "No version information"; }; return (
{isRunning &&
Task is running...
} {error &&
Task failed: {error.toString()}
} {result &&
Task result: {result}
}
); }