import { useEffect, useState } from "react";
import { changes, getEnv } from "@ledgerhq/live-env";
export default function useEnv(type) {
    const [env, setEnv] = useState(() => getEnv(type));
    useEffect(() => {
        const sub = changes.subscribe(({ name, value }) => {
            if (type === name) {
                setEnv(value);
            }
        });
        return () => sub.unsubscribe();
    }, [type]);
    return env;
}
//# sourceMappingURL=useEnv.js.map