score:0
you can do the folloowing: in your mapdispatchtoprops fn return actions like this:
function mapdispatchtoprops(dispatch) {
return {
updateactivepage: (pagenumber) => {
return new promise((resolve, reject) => {
dispatch(actions.updatevisualstate(pagenumber, resolve, reject));
});
}
};
in this case, you will be able to use then for your actions in the view:
this.props.updateactivepage(pagenumber).then(()=>{
this.props.fetchuserjd(this.props.activepage);
})
you just need to choose the right place to resolve the promise.
Source: stackoverflow.com
Related Query
- Call an Async action after updating the react state
- React state not updating after async await call
- react redux async action call next function after finishing the function
- React make an async call on data after retrieving it from the state
- Function call after updating the state in React
- How to get the changed state after an async action, using React functional hooks
- React, updating state in child component using props after async call in parent component
- How to test state update and component rerender after async call in react
- React Redux with redux-observable use the router to navigate to a different page after async action complete
- Updating state after async action in react-redux
- State not updating after axios call in react
- React is not updating the UI after receiveing data from the API call (using hooks)
- Call a method after the state changes by getDerivedStateFromProps in react js
- React hook not updating after the API call
- How to switch the state of buttons in react hooks after updating it through rest api?
- How to populate the state after an action call in useEffect?
- update react child component's state using props received from an async api call made in the parent component
- useSelector hook first returns undefined state and after an action call returns the state correctly
- React state not updating after function call
- React FullCalendar Unable to add new event to the calendar after updating the state
- Using axios or async network call in the actions of the redux, updating the initial state
- React with Redux: Call a function after updating the store
- Can't stop React from updating the main component after state change
- react state maps not showing data even after updating the states - react js
- Rerendering state in React after async call
- React Context API does not update state after async call
- React onChange doesn't return updated value after updating the state
- Setting state not working after the first API call in react
- React UseState is not re-rendering the App Component after updating the state
- Why react won't set the state after Redux action trigger?
More Query from same tag
- Undefined is not an object in .map
- How can i hide some Navbar and Sidebar on some selected component
- How to create a route with get parameter in v6?
- media query doesn't work properly with css modules when using an arbitrary class name
- How to add user name field in PeerJs
- The React Application does not work as intended when submitting a form
- 'useState' value is empty
- ReactDOM RSS renderToString production error
- Search Bar with Two options as dropdown (ReactJS)
- How to return an event from Button using react-bootstrap?
- Is it possible to generate react props using a for loop?
- howto reset password using nodejs
- Why map function in ES6 is not refreshed?
- creating a common function
- Flux/Redux trigger a side-effect at the end of an action
- Jest - How to test output of react methods is correct?
- how to get the provider access token in next-auth
- How to differentiate some content when pages are created programmatically in Gatsby JS
- Can someone explain me the difference between both this if conditions in React?
- didn't write data in google sheet in next js
- React hook for page scroll position causing re-renders on scroll
- redux-form : How to display form values on another component
- How to dispatch action from async.queue in react redux?
- Am I doing it correct? Why date not showing up?
- Why does my axios request print in console but doesn't set state
- Bind text input value on change event - React Native + Redux
- Override Antd's selected Item color
- NextJS SSR and Client side state
- get CSS from chrome dev tools as JavaScript object value
- Why is the useEffect changes to state in the Parent not happening in the Child?