Я новичок в Redux.Может кто-нибудь объяснить, как я могу получить данные запроса от Get
componentDidMount() {
axios.get('/api/v3/products', {
params: {
pageNumber: 1,
pageSize: 500,
}
})
.then(response => {
this.setState({result: response.data});
})
.catch(function (error) {
console.log('error TestMethod', error);
})
.then(function () {
// always executed
});
}
И положить его в магазин в Redux
const initState = {
products: [
{id: 1, title: 'first'},
{id: 2, title: 'second'},
{id: 3, title: 'third'},
{id: 4, title: 'fourth'},
{id: 5, title: 'fifth'},
],
};
Есть ли какие-либо методы?