Connecting to the Backend - Consuming APIs - UseEffect Hook
PreviousHands-on : Build a Grocery List AppNextLesson 1 - Connecting to the Back End - Understanding Side Effects, Hooks and useEffect - Overview
Last updated
Last updated
Vite provides built-in support for environment variables using the .env
files. You can create different .env
files for different environments like development, production, and testing.
Create a .env
file in the root of your Vite project. You can create this file manually or use the touch
command in your terminal.
Add your environment variables to the .env
file. Prefix your variables with VITE_
to make them available in your Vite application.
Access your environment variables in your Vite application using import.meta.env
.
Remember to restart your development server after adding or updating environment variables in your .env
file.
ref site