I am curious how I would store the data found from an API call into a redux store and then access it. This is the code I am working with. I am unfamiliar with redux and would like a better understanding of how to use it.
const mapStateToProps = state => {
return {
test: state.simpleReducer.test
};
};
const mapDispatchToProps = dispatch => ({
simpleAction: () => dispatch(simpleAction())
});
class App extends Component {
weatherData = {};
componentDidMount = () => {
this.newAction();
};
newAction = async () => {
let weatherResponse;
await axios({
method: "get",
url: "http://api.openweathermap.org/data/2.5/weather?q=${city},${country}&appid=${API_KEY}&units=metric"
}).then(function(response) {
weatherResponse = [...response.data];
});
this.weatherData = weatherResponse;
console.log(this.weatherData);
};