score:3
Accepted answer
I think I know what you mean.
You can change that behavior by setting returnRejectedPromiseOnError in middleware config.
Note that promise is returned only to chain actions. If you set this option you will have to always apply catch
callback or you will be getting unhandled rejection when calling Promise
errors. And this might be causing some issues when handled in components, because these callbacks may be fired when component is already unmounted.
Im my code I try to avoid then
as much as possible to avoid these side effects but when I have to I do it like:
fetchSomething.then(action => {
if(action.type.endsWith('SUCCESS')) {
....
}
})
Source: stackoverflow.com
Related Query
- Handling Axios error in React
- How does react redux promise middleware send the resulting action to the dispatch?
- Handling promise chain inside a React component constructor
- Axios get function returns a promise in React
- REACT How to make AJAX requests with Redux and Axios (with promise middleware)?
- .then promise not working within axios delete request in react application
- React - Axios promise pending value undefined
- Redirect component of React not working as expected in axios .then() promise
- How do I fix a uncaught in promise error in react with typescript when doing a axios post request?
- Axios request in react for handling http request
- Promise data when using react and axios
- handling promise for react render
- Multiple API handling through Axios in react application
- Trouble understanding axios error handling in react
- Fetched API Data not recognized after handling the promise with a Middleware
- Is this React and Axios then promise usage correct?
- How to convert Promise to String? I used Axios and return the data to my react Component
- React and TypeScript—which types for an Axios response?
- How to set state of response from axios in react
- How to redirect from axios interceptor with react Router V4?
- Error handling in React best practices
- Promise Error: Objects are not valid as a React child
- Handling ajax with React
- Handling scroll Animation in React
- Handling api calls in Redux with Axios
- Does this.setState return promise in react
- How to setup Axios interceptors with React Context properly?
- React - axios - blocked by CORS policy. How to unblock
- Emitting and handling global events with react
- SSL certificate - disable verification in axios and react
More Query from same tag
- React - Error when import dependency that depends from another already on package.json
- react handle simultaneous click and blur events
- Loading micro frontend root App component's CSS in singleSpaReact on mounting to the host application
- (crl + /) in vscode short cut makes incorrect jsx comment
- Waiting for request to finish before performing operation ReactJS
- Got the error when Rendering the material ui autocomplete
- Default value in input field lost after click
- Moving handler functions outside of react component
- How can I return combined reducers in react-redux?
- BrowserRouter vs Router with history.push()
- Axios not authenticating to API
- Remove margin from body in React
- Assigning apollo mutations with a ternary in an onClick?
- How do I share the value of a variable to another component in react?
- Scroll to top in Reactjs
- React admin unmet peer dependencies warning
- Context Provider not triggering re-render of this.props.children
- "MulterError: Unexpected field\n at wrappedFileFilter using AWS, Multer S3, NodeJS, Mongo
- How to add different text after the map function has rendered 3 times?
- Infinite nested elements in json file and How to get elements?
- React Bootstrap, Adding Hover Effects to NavItems
- How to create nested layout routing components in react router?
- React tailwind css -right position show scroll bar
- React How can I receive the 3h rain foreact from openweathermap (Identifier directly after number error)
- Combine arrays and merge keys together for table output
- Material-UI Icon element cropping FontAwesome icon
- How to add class to element in reactjs?
- redirect all /api/.. requests to express
- How to install react-toastr
- _onLocationFound doesn't work in leaflet.locationcontrol