deno.land / x / ultra@v2.3.8 / hooks / use-env.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { useContext, useMemo } from "react";import EnvContext from "./env-context.js";
/** * @param {string} name */export default function useEnv(name) { if ( typeof Deno === "undefined" && name.startsWith("ULTRA_PUBLIC_") === false ) { throw new Error(`Attempt to access non-public env variable. ${name}`); } const context = useContext(EnvContext); return useMemo(() => context.get(name), [name]);}
ultra

Version Info

Tagged at
8 months ago