Skip to content

initial commit#78

Open
Peter-JC-Wu wants to merge 6 commits intoprojectshft:masterfrom
Peter-JC-Wu:master
Open

initial commit#78
Peter-JC-Wu wants to merge 6 commits intoprojectshft:masterfrom
Peter-JC-Wu:master

Conversation

@Peter-JC-Wu
Copy link
Copy Markdown

No description provided.

export function fetchForecast (query) {
const request = axios.get('https://api.openweathermap.org/data/2.5/forecast?q=' + query + '&appid=' + keyAPI + '&units=imperial');

// console.log(request);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its important to clean up commented out code like this

return {
queryCityEntries: { ...state.queryCityEntries, [action.payload.data.city.id]: {
city: action.payload.data.city.name,
temperature: action.payload.data.list.map(Object => Object.main.temp),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend using something more descriptive than Object

</tr>
)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing semi-colon

<SparklinesLine color='red'/>
<SparklinesReferenceLine type='mean'/>
</Sparklines>
<div>{Math.round(forecasts.queryCityEntries[id].humidity.reduce((a, b) => a + b) / forecasts.queryCityEntries[id].humidity.length)} %</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using generic variables (a,b)

<SparklinesLine color='orange'/>
<SparklinesReferenceLine type='mean'/>
</Sparklines>
<div>{Math.round(forecasts.queryCityEntries[id].pressure.reduce((a, b) => a + b) / forecasts.queryCityEntries[id].pressure.length)} hPa</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing a lot of repetition, could possibly extra this out into a helper function

@@ -0,0 +1,38 @@
import { useState } from "react";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work breaking these out into components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants