Clima React App is composed of four React components.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.
Header and Error are purely presentational. Formulario manages its own local validation state. Clima reads from the OpenWeatherMap response object and converts temperatures from Kelvin to Celsius before rendering. All components receive their data exclusively through props passed down from App.
Header
Header renders a Materialize CSS top navigation bar containing the app title as the brand logo text.
Props
The text displayed as the navigation bar’s brand logo. Rendered inside an
<a className="brand-logo"> element.Source
Herader (a typo of “Header”) but exported under that same name. App.js imports it as Header, which works because the import alias is independent of the variable name inside the file.
Formulario
Formulario renders a controlled form with a city text input and a country <select> dropdown. It manages its own local error boolean for empty-field validation and calls setConsultar(true) on valid submission to trigger the API call in App.
Props
The current search state from
App. Shape: { ciudad: string, pais: string }. Used to make the form inputs controlled.State setter from
App. Called on every input change with the spread-updated busqueda object to lift form state up.State setter from
App. Called with true on valid form submission to trigger the useEffect API call in App.Source
Formulario keeps its own error state separate from App’s error state. The local flag controls whether an inline validation message is shown; App’s error flag is only set after a failed API response.
Clima
Clima renders a Materialize card displaying the current temperature, maximum temperature, and minimum temperature for the city returned by the OpenWeatherMap API. All temperatures are converted from Kelvin to Celsius before display.
Props
The raw JSON response from the OpenWeatherMap
/data/2.5/weather endpoint. The component reads resultado.name (city name string) and resultado.main (object containing temp, temp_max, and temp_min in Kelvin).Source
if (!name) return null. On the initial render resultado is an empty object {}, so name is undefined and the component renders nothing rather than crashing.
Error
Error renders a single paragraph styled with Materialize’s red darken-4 background class and a custom error CSS class from index.css that adds padding, centers text, and forces white text color.
Props
The error message string to display. Rendered as the text content of a
<p> element.Source
Error is used in two places: inside Formulario for empty-field validation ("Todos los campos son obligatorios") and inside App for failed API responses ("No hay resultados").