Skip to content

Redux weather first submission#76

Open
becky-zhou wants to merge 1 commit intoprojectshft:masterfrom
becky-zhou:master
Open

Redux weather first submission#76
becky-zhou wants to merge 1 commit intoprojectshft:masterfrom
becky-zhou:master

Conversation

@becky-zhou
Copy link

No description provided.

</div>
);
<Provider store={WeatherStore}>
<div>

Choose a reason for hiding this comment

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

This div isn't needed. It doesn't hurt anything, but it does add another element to the DOM, which can get messy.


const HandleSubmit = (e) => {
e.preventDefault();
if (searchInput !== ''){

Choose a reason for hiding this comment

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

Nice null check!

<tr key={item.city}> */}
{/* {!weatherData.loading && weatherData.data.temperature && getWeather.SUCCESS ? ( */}
{ weatherData.data.temperature && getWeather.SUCCESS ? (
<React.Fragment>

Choose a reason for hiding this comment

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

A shorthand for fragments is empty brackets, like this <></>

export const fetchWeather = (city) => {
return (dispatch) => {
dispatch({ type: getWeather.PENDING });
axios.get(`https://api.openweathermap.org/data/2.5/forecast?q=${city}&units=metric&appid=d804734ee459510001eab20076e914f2`)

Choose a reason for hiding this comment

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

You should have the appId in an environment variable. If the curriculum hasn't gone over it yet, you can lookup some vids on how to do it. API keys should be kept secret, and they help you do that.

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.

2 participants