import { useEffect, useState } from 'react' /** * https://nextjs.org/docs/basic-features/environment-variables */ function EnvTest() { const [showEnv, setShowEnv] = useState(false) useEffect(() => setShowEnv(true), []) return (
By default environment variables are only available in the Node.js environment, meaning they won't be exposed to the browser.
NEXT_PUBLIC_ environment variables are available in the browser, and can be used to configure the
application.
✅ Public Environment token found:{' '}
{process.env.NEXT_PUBLIC_GREETINGS || 'NOT FOUND (something went wrong)'}
❌ Private Environment token should not be found:{' '}
{process.env.TEST_ENV_VAR || 'Everything worked'}