score:0
Looks like you are missing writeToFirebase
call, and calling then
from the wrong place, try this code instead:
export const updateUserDetailsThenUpdateFirebase = updatedUser => {
return (dispatch, getState) => {
dispatch(updateUserDetails(updatedUser));
writeToFirebase(updatedUser).then(() => {
const storeData = getState();
// ... called after firebase finishes
});
};
};
score:0
ah, so I was very close: amazingly, and amagically,
this works:
export const updateUserDetailsThenUpdateFirebase = updatedUser => {
return (dispatch, getState) => {
return dispatch(updateUserDetails(updatedUser)).then(() => {
const foundUser = getState().selectedUser;
const userToUpdate = getState().users.users.filter(
user => user.id === foundUser.id
);
return writeToFirebase(userToUpdate, 1);
});
};
};
Source: stackoverflow.com
Related Query
- Chaining redux thunks
- chaining multiple async dispatch in Redux
- Chaining Redux actions
- Chaining redux action creator Promise.then() in react component
- Why do I need redux async thunks
- react redux / react thunks api
- Chaining Dispatched Actions with Redux Promise Middleware and JHipster
- Redux shorthand `mapDispatchToProps` returns undefined for `async` actions / thunks
- Chaining redux payload with axios
- Dispatching Redux Actions from Thunks with IIFEs
- Chaining Redux Async Actions
- Redux connect chaining async actions
- How to resolve async chaining using thunk in redux
- React Redux Thunk Chaining Actions Issue
- react redux and thunks / axios / is not a function
- Chaining redux connect mapStateToProps , to access props inside mapDispatchToProps
- Equivalent of a yield take Redux Saga in Redux thunks
- reactjs using redux and thunks dispatch doesn't work
- Chaining redux thunk actions together
- How can I use the current status of redux after the thunks and actions have finished?
- Why use Redux over Facebook Flux?
- What is the best way to access redux store outside a react component?
- What could be the downsides of using Redux instead of Flux
- What's the '@' (at symbol) in the Redux @connect decorator?
- Difference between component and container in react redux
- 'dispatch' is not a function when argument to mapToDispatchToProps() in Redux
- How to update single value inside specific array item in redux
- Is store.dispatch in Redux synchronous or asynchronous
- React + Redux - What's the best way to handle CRUD in a form component?
- Get version number from package.json in React Redux (create-react-app)
More Query from same tag
- I try to recover a state in store (react, redux)
- How can I put content over my canvas in React
- Using React Hooks How Can I Have two search inputs that work together to filter results
- Firebase React: Remove Item (Map) from array in firestore
- Converting ES5 Mixins to Higher Order Components
- How to change the word "WEEKLY" to "Weekly" in react js
- new FileReader(); react. when iterating over items
- Call function only after multiple states have completed updating
- The value of "offset" is out of range. It must be >= 0 && <= 17825792
- Reactjs code works without error but executes twice
- Is there a way to set defaultValues in a child component using react hook form with useFieldArray hook - not using the useForm hook?
- Cannot upload id by using uuid on firebase with React.js
- React add to props object
- Configure inline image import in Babel
- Re-render component on props update
- React - error while collecting modules by webpack
- User Authentication for API from React App
- How to see if gatsby-plugin-offline is working
- How to update state if I have props coming from parent component in React Hooks
- Accessing variable from imported class from another React script
- React render using state-pool
- Render react component from a different file
- How to prevent React Hook's useEffect from fetching data multiple times
- Update one parameter using Redux Tool kit
- State updating for onkeyup, but not for onclick in React
- Trouble while using .svg file in React.js code
- Firebase Bind and Unbind from State in React when using Re-base
- Having this error in the console Each child in a list should have a unique "key" prop
- In Mui Autocomplete how to call a function after selecting an option (not simultaneously)
- How to display an array of objects in a table in react