Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jantoniogc/CursoReact-Clima/llms.txt

Use this file to discover all available pages before exploring further.

Because npm run build produces a static site — only HTML, JavaScript, and CSS files — you can deploy Clima React App to any platform that serves static files. No server-side runtime is required. The three most common free options are Vercel, Netlify, and GitHub Pages.

Hosting platforms

Install the Vercel CLI and deploy in one command:
npm install -g vercel
vercel --prod
Vercel automatically detects Create React App projects and runs npm run build on its build servers. The contents of the build/ directory are served from Vercel’s global edge network. No additional configuration is needed.

Environment variables and the API key

To avoid hardcoding the OpenWeatherMap API key in source code, Create React App supports .env files. Create a .env file in the project root with:
REACT_APP_API_KEY=your_key_here
Then reference it in src/App.js as process.env.REACT_APP_API_KEY. Variables must be prefixed with REACT_APP_ to be included in the browser bundle.
Never commit .env files to version control. Add .env to your .gitignore and use your hosting platform’s environment variable settings (Vercel dashboard, Netlify environment variables, or GitHub Actions secrets) to inject the key at build time.

Materialize CSS CDN dependency

The app’s public/index.html loads Materialize CSS and its JavaScript from the Cloudflare CDN:
<!-- CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script>
Ensure your deployed environment has outbound internet access to cdnjs.cloudflare.com. All three hosting platforms listed above (Vercel, Netlify, GitHub Pages) serve pages to browsers that fetch these assets directly, so no special configuration is needed in typical deployments. If you need to operate in an air-gapped or offline environment, install Materialize via npm and import it in your JavaScript instead of relying on the CDN:
npm install materialize-css
import 'materialize-css/dist/css/materialize.min.css';
import M from 'materialize-css';
Then remove the CDN <link> and <script> tags from public/index.html.

Build docs developers (and LLMs) love