Search posts, tags, users, and pages
Grace Frank
What if I want to use env variables, will I define it differently from the frontend?
Mary Etokwudo
I am a fullstack developer with experience in NodeJS, React, GraphQL and every other thing in-between including HTML and CSS 😀
Hi Grace! When you add the prefix NEXT_PUBLIC_ to your env variables, Next.js will make it available on the browser. For example:
NEXT_PUBLIC_
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID='your_google_analytics_id'
Note that it is not advisable to expose sensitive variables to the browser. Let me know if this works or not :)