build with @reduxjs/toolkit.
A rtk extraReducer method execution process collector
The execution status of the current method can be obtained from the 【loading.effects】 of the 【store】 every time the createAsyncThunk executes
Judge whether the execution is completed by returning true and false
excemple
import { useLoading } from 'rtk-loading';
const initLoading = loading.effects['app/init']
npm install rtk-loading
import { configureStore } from "@reduxjs/toolkit";
import { loading, effectsLoadingMiddleware } from "rtk-loading";
const store = configureStore({
reducer: {
loading: loading,
//... you reducer
},
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(effectsLoadingMiddleware),
});
export default store;
import { useLoading } from 'rtk-loading';
const loading = useLoading();
loading.effects['']