useActiveFile()
Hook
The useActiveFile()
hook returns the file actively focused on by the current user.
Usage
import { useActiveFile } from "@replit/extensions-react";
const Component = () => {
const activeFile = useActiveFile();
return (
<>
<span>Active File: {activeFile}</span>
</>
);
};
Signature
function useActiveFile(): string | null;