Ir para o conteúdo principal
e-Disciplinas
  • Disciplinas »
    2026 2025 2024 2023 2022 2021 2020 2019 2018 2017 2016 2015 2014 2013 2012 AACCs/FFLCH Pró-Reitoria de Pós-Graduação Outros
  • Suporte »
    Acesso Perfis Ouvintes Docentes Criação de Disciplinas da USP Documentação HelpDesk e Contato Guia de uso Sobre
  • Português - Brasil ‎(pt_br)‎
    Deutsch ‎(de)‎ English ‎(en)‎ Español - Internacional ‎(es)‎ Français ‎(fr)‎ Italiano ‎(it)‎ Português - Brasil ‎(pt_br)‎
  • Fechar
    Alternar entrada de pesquisa
  • Acessar

SCC0219 - Introdução ao Desenvolvimento Web (2025)

  1. Início
  2. Ambientes
  3. 2025
  4. ICMC
  5. SCC
  6. SCC0219-2025
  7. Module 7: React or Vue
  8. Exercise 14: Components lifecycle methods and stat...

Exercise 14: Components lifecycle methods and state management

Condições de conclusão
Aberto: sexta-feira, 16 mai. 2025, 08:00
Vencimento: sexta-feira, 16 mai. 2025, 12:00

 Weather App using React or Vue.js

Upload a html file named USPnumber1.USPnumber2.zip. If you need to upload a file after the deadline use late.USPnumber1.USPnumber2.zip

Remove the node_modules folder before sending the zip.

Activity: Building a Simple Weather App using React or Vue.js

Objective: This activity will challenge you to create a simple weather application using either React or Vue.js. This app will make use of component lifecycle methods (or the Composition API in Vue.js), state management, and data flow between components.

Instructions:

  1. Setup: Create a new React Hooks or Vue.js app using Create React App, Vue CLI, or your preferred setup.

  2. Components: Create the following components:

    • App: This is the main component that will hold other components.
    • SearchBar: This component should have an input field for the user to enter a city name.
    • WeatherDisplay: This component will display the weather information returned by the API.
  3. State Management and Data Flow: Implement the following requirements:

    • The App component should maintain the state of the current city searched by the user.
    • When the user types a city name into the SearchBar and presses Enter, this should trigger an update to the state in the App component.
    • The WeatherDisplay component should receive the city name as a prop and fetch weather data for that city.
  4. Component Lifecycle / Composition API: Implement the following requirements:

    • If you're using React: Use useEffect() in the WeatherDisplay component to fetch data when the component first mounts or whenever the city name prop changes. In React with classes, useEffect is equivalent to componentDidMount() and componentDidUpdate().
    • If you're using Vue.js: Use the mounted lifecycle hook to fetch data when the component is first rendered, and a watch or the Composition API's watchEffect to fetch new data whenever the city name prop changes.
  5. Weather API: Use the Fetch API to send GET requests to the Open-Meteo public APIs. To find the city's latitude and longitude, use the endpoint  https://geocoding-api.open-meteo.com/v1/search?name={city}&count=1 (API Documentation) OR create a list of, at least, 5 cities with their latitudes and longitudes. To find the weather, use the endpoint: https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}&current_weather=true (API Documentation). 

  6. Error Handling: Implement error handling for the case when the user searches for a city that the API doesn't recognize.
  7. Style your components using CSS to improve the user experience.

  8. Finally, test your application to ensure it behaves as expected. Check that the data flow is correct and that the component lifecycle methods (or the Composition API in Vue.js) are working as they should.

This activity touches on several key concepts of both React and Vue.js including component structure, state management, handling user input, and lifecycle methods (or the Composition API). Take your time to understand each concept. Happy coding!


◄ Exercise 13: React/Vue
Group Discussion: React, Vue and Others ►

Blocos

Pular Navegação
  • Início

    • e-Disciplinas

      • Meus Ambientes

      • Tags

      • Pesquisar

      • PáginaSobre

      • PáginaHelp Desk e Contato

      • PáginaGuia

    • Meus Ambientes

    • Ambientes

      • 2025

        • CENA

        • EACH

        • ECA

        • EE

        • EEFE

        • EEFERP

        • EEL

        • EERP

        • EESC

        • EP

        • ESALQ

        • FAU

        • FCF

        • FCFRP

        • FD

        • FDRP

        • FE

        • FEA

        • FEARP

        • FFCLRP

        • FFLCH

        • FM

        • FMBRU

        • FMRP

        • FMVZ

        • FO

        • FOB

        • FORP

        • FSP

        • FZEA

        • IAG

        • IAU

        • IB

        • ICB

        • ICMC

          • SMA

          • SME

          • 550

          • SSC

          • SCC

            • TCCs do SCC

            • SCC0211-2025

            • SCC5920--2025

            • SCC0124-201-2025

            • SCC0283-201-2025

            • SCC0271-201-2025

            • SCC0230-202-2025

            • SCC5878-2025

            • SCC0233-201-2025

            • SCC0295-201-2025

            • ED - SCC0122 - 2025

            • SCC0634-201-2025

            • SCC0245-201-2025

            • SCC0607-201-2025

            • SCC0220-201-2025

            • LabBD-SCC0641-2025

            • SCC0560-201-2025

            • SCC5836--2025

            • SCC0252-201-2025

            • SCC0219-201-2025

            • SCC0202-2025

            • SCC5977--2025

            • SCC5809--2025

            • SCC5960--2025

            • SCC5959--2025

            • SCC5952--2025

            • SCC0277-201-2025

            • SCC0218-2025

            • SCC0227/SCC0229--2025

            • SCC0505--2025

            • SCC5832--2025

            • SCC0205-202-2025

            • SCC0205-201-2025

            • SCC0502-201-2025

            • SCC0223-201-2025

            • SCC0207-2025

            • SCC0580-201-2025

            • SCC0302-2025

            • SCC5949--2025

            • SCC5982--2025

            • SCC0216-2025

            • SCC0219-2025

              • Geral

              • Group Assignment

              • Course Introduction

              • Module 1: HTTP Protocol

              • Module 2: HTML

              • Module 3: CSS

              • Module 4: JavaScript

              • Module 5: DOM & Events

              • Module 6: AJAX Calls

              • Milestone 1

              • Module 7: React or Vue

                • TarefaExercise 14: Components lifecycle methods and stat...

              • Module 8: Node.js/ExpressJS

              • Milestone 2

              • Module 9: NoSQL Databases

              • Final Presentations

              • Final Test

          • EST

          • MAI

          • SMA

        • IEB

        • IEE

        • IF

        • IFQSC

        • IFSC

        • IGc

        • IME

        • IO

        • IP

        • IPEN

        • IQ

        • IQSC

        • IRI

        • HRAC

        • MAC

        • MAE

        • MP

        • MZ

        • RUSP

      • 2026

      • 2024

      • 2023

      • 2022

      • 2021

      • 2020

      • 2019

      • 2018

      • 2017

      • 2016

      • 2015

      • 2014

      • 2013

      • 2012

      • Grupos de Estudos, Pesquisa e Outros

      • PRPG - Pró-Reitoria de Pós-Graduação

      • STI

Blocos suplementares

Você acessou como visitante (Acessar)
Fornecido por Moodle