score:1
you shouldn't expect updated state within the same function call. if you want to have new state, you should probably process it in the same action where you received it:
export const loadcourseinfo = (id:any) => async (dispatch:dispatch, getstate:any) => {
...
const course = await apiservice.courses.getcourse(id);
// use it right here
};
or you could use updated state on next render.
Source: stackoverflow.com
Related Query
- Redux state is not updated at time that i acces it
- Redux not updating components when deep Immutable state properties are updated
- Redux State not Updating the first time
- getDerivedStateFromProps Does not re-render after Redux Reducer state is updated
- useEffect() chain function call not getting the updated redux state
- React Hooks State is not updated the first time
- Reducer not updating state on action being fired and hence redux store/state not being updated
- Able to get the updated state from redux store but not able to access the objects inside the updated state from the receiver component
- Redux is not giving updated state
- Reference Item State Not Updated in React Redux on Save
- React component is not getting updated when state changes into the redux
- Redux state is updated but UI is not updating
- I am trying to load data from redux store on click and updating the state, but the data from state is not getting updated on the click
- React component not refreshing when redux state has been updated with successful action
- State store not getting updated properly in redux
- Redux state updates but component state not changing from first time
- component does not display updated redux state
- Even after redux state update mapStateToProps not returning updated props to components in react
- My redux app needs state to be updated before it can contact the server, but this is not allowed in redux
- Function not receiving updated redux state even on re-render
- Not getting updated state from redux store when the state is update
- Text is not updated when I changed my Redux state
- React: Access to the (updated) state with useState: it is not updated inside the component that creates it, but it is outside where it is called
- the state inside hooks are not updated for first time on form submit in react
- Component does not re-render although redux state is updated
- Redux state is updated but not the component
- React + Redux Updated State Not Getting Re-Rendered
- react redux does not return updated state when component load
- Redux State Not Updated In Dev Tools But Current State Is Being Reflected In Props
- Redux State Does Not Get Updated In Dev Tools But Current State Is Being Reflected In Props
More Query from same tag
- setState not working
- Is there an replacement Parameter for onChange in react Route v4
- React.js: useState Hook Setter is not updating the state
- Structuring the store of a localized react / redux app
- Why reply variable is giving index number of greetReply array? I want the value from that array
- Is it possible to pass the value of an 'id' attribute into a function passed in the onClick attribute in React?
- Redux fetch actions
- React js random color
- How can I add a scale on react leaflet?
- Uncaught TypeError: Cannot read property 'displayName' of undefined
- Gatsby build / SSR swapping out components causing display errors
- How to block typing "e" and "-" characters in React Hook Form input?
- npx create-react-app my-app ERROR "In most cases you are behind a proxy..."
- usestate to move component on page to a different area when clicked
- App state, and actions not mapping to props with redux
- fetch() POST request to Express generates empty body {}
- Typescript - Shorten code that has repetitive if expressions
- Look up nested arrays of objects for a match by separate criteria on each level
- adding multiple states in context provider with react hooks
- How to reload page/router in handleSubmit method after submit?
- change state of clicked target inside mapped array
- class doesn't get compiled by babel (nextjs / webpack)
- React: 404/No folder structure after running `npm run build`
- Graphql saying Validation error of type undefined
- converting $.Deferred() to react
- How to create colored squares board in React?
- Is it possible in Webpack to run my custom Loader whenever I import a fixed string and not a file?
- ClojureScript: how to change CodeMirror reactively with Reagent
- Start a setTimeout in componentDidMount and end it in componentWillUnmount in React
- React/Redux calls for a row of cards