Open AlexisTercero55 opened 1 year ago
Repo cloned in local machine and successfully running in localhost.
This app use create-react-app as bundler and plain Redux for state management:
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.21.0",
"bootstrap": "^4.5.3",
"gh-pages": "^3.1.0",
"lodash": "^4.17.20",
"moment": "^2.29.1",
"react": "^16.13.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^16.13.1",
"react-redux": "^7.2.2",
"react-scripts": "3.4.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
src/index.js
{ createStore, applyMiddleware } from 'redux'
<Provider store={createStore(reducers, applyMiddleware(thunk))}>
<App />
</Provider>
image from freecodecamp.org
src/components/App.js
Use
.container-fluid
for a full width container, spanning the entire width of the viewport.
<div className="container-fluid">
<Weather />
</div>
Consider use <Container fluid />
react-bootstrap component instead .container-fluid
CSS Bootstrap class
import Container from 'react-bootstrap/Container';
import Weather from './Weather';
<Container fluid>
<Weather />
</Container>
src/components/Weather.js
{ fetchWeatherAndLocation }
from src/actions/index.js
export const fetchWeatherAndLocation = (city) =>
{
return async (dispatch, getState) =>
{
await dispatch(fetchLocation(city));
const coords = getState().location.coord;
await dispatch(fetchWeather(coords.lat, coords.lon));
};
}
import Header from './Header';
import CurrentWeather from './CurrentWeather';
import HourlyWeather from './HourlyWeather';
import DailyWeather from './DailyWeather';
import WeatherDescription from './WeatherDescription';
Understanding base repo edehlol/weather.