I have an async action that retrieves data from a REST API:
export const list = (top, skip) => dispatch => { dispatch({ type: 'LIST.REQUEST' }); $.get(API_URL, { top: top, skip: skip }) .done((data, testStatus, jqXHR) => { dispatch({ type: 'LIST.SUCCESS', data: data }); }); };
A synchronization that changes the state of skip :
export const setSkip = (skip) => { return { type: 'LIST.SET_SKIP', skip: skip }; };
The initial state for top = 10, skip = 0 . In component:
class List extends Component { componentDidMount() { this.list(); } nextPage() { let top = this.props.list.top; let skip = this.props.list.skip;
When you click Next , clicking the skip button using an asynchronous action does not change. How can I send an action after synchronization ?
javascript reactjs redux action dispatch
Denis bednov
source share