An Interest In:
Web News this Week
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
- March 14, 2024
Solution to Problems that Beginners Encounter ~React/Deploy~
I've been learning React only for three weeks, but I've had so many problems. I'll share one of them I encountered while I was deploying my project. It was not the same way I usually do since this time I was using API.
The project was to create a weather app using OpenWeatherMap, push the code to GitHub and deploy it to Netlify.
I hid the API key in a ".env" file with a variable name, just like this: VARIABLE_NAME_FOR_API = abcde12345
Here is what I needed to do:
Netlify
(1) Set Environment Variables
Deploys > Deploy settings > Environment
> Environment variables > Edit variables
Key => VARIABLE_NAME_FOR_API value => abcde12345
(2) Set Build Command
Deploys > Deploy settings > Continuous Deployment
> Build settings > Build command
Build command => CI= yarn run build* You can change 'yarn' to 'npm' if you're using npm* Make sure it is capital i, and there's no space between "CI" and "=". I typed "CI = yarn run build" and failed so many times.
I hope this will help those who have the same problem.
Original Link: https://dev.to/ayako_yk/solution-to-problems-that-beginners-encounter-reactdeploy-1hag
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To