React Boilerplate Redux Saga Hoc

Search Results

No results for 'N/A'
1. Getting Started
2. Basic Concepts
3. Handlers
4. Advanced Concepts
4.0.1 Creating Custom Reducer4.0.2 Modifying api end points reducer constants4.0.3 Don't reset on setting to initial state4.0.4 Cancelling Api Calls# cancel on unmount4.0.5 Axios Interceptors4.0.6 Inject saga and reducer to the store4.0.7 Inject saga and reducer to the store by using hooks4.0.8 Util Functions4.0.9 PARAMS4.1.0 Handling Multiple tasks
5. Examples6. Advanced Examples7. ParamsApi ReferenceComplete DocumentationPrevious DocumentationReadme

Cancelling Api Calls

# cancel on unmount

Note:
-This function will help cancel unwanted api calls
const { ON_SUCCESS, ON_UNMOUNT } = commonConstants;
const { DEMO_API_CONFIGURATION_CANCEL, DEMO_API_CONFIGURATION_CALL } = props;
useEffect(() => {
DEMO_API_CONFIGURATION_CALL();
return () => {
DEMO_API_CONFIGURATION_CANCEL(ON_UNMOUNT);
};
}, []);
Note:
-ON_UMOUNT will reset the particular state to initial
const { ON_SUCCESS, ON_UNMOUNT } = commonConstants;
const { DEMO_API_CONFIGURATION_CANCEL, DEMO_API_CONFIGURATION_CALL } = props;
useEffect(() => {
DEMO_API_CONFIGURATION_CALL();
return () => {
DEMO_API_CONFIGURATION_CANCEL(ON_UNMOUNT, ["filter"]);
};
}, []);