      try {
        const data = await api(`pathWithQueryParams`, {
          method: 'GET',
         });
          setValue(prev => ({
           ...prev,
            listCategory: data.data,
            currentPage: data.page,
            buttonsPagination: Math.ceil(data.total / data.perPage),
            quantityElementPage: data.perPage,
         }));
      } catch (e) {
        console.error(e);
      }
    }

A:

You can just maintain an isLoading value in state in the reducer, and the action "LOAD_DATA_START" alone is enough to know when data is loading. In the "LOAD_DATA_END" action you spread in the existing state and new data, and don't forget to toggle back the loading state.
EditListReducer.js:
const initialState = {
  listCategory: [],
  currentPage: 1,
  quantityElementPage: 3,
  buttonsPagination: 0,
  buttonsQuantityElementPage: 3,
  sortAscDesc: "asc",
  searchInput: "",
  isLoading: false // <-- add loading to state slice
};

export function EditListReducer(state = initialState, action) {
  switch (action.type) {
    case "LOAD_DATA_START":
      return {
       ...state,
        isLoading: true // <-- just set loading true
      };
    case "LOAD_DATA_END":
      return {
       ...state,
       ...action.payload, // <-- spread in payload from action
        isLoading: false // <-- set loading false
      };
    default:
      return state;
  }
}

Home.js:
const Home = () => {
  useEffect(() => {
    fetchData(
      value.currentPage,
      value.quantityElementPage,
      value.sortAscDesc,
      value.searchInput
    );
  }, [
    value.currentPage,
    value.quantityElementPage,
    value.sortAscDesc,
    value.searchInput
  ]);

  function fetchData(
    valuePage,
    valueElement,
    valueSort,
    value
try { 
         const data = await api(`pathWithQueryParams `, { 
           method:' GET', 
          }); 
           setValue(prev = > ({ 
           ... prev, 
             listCategory: data.data, 
             currentPage: data.page, 
             buttonsPagination: Math.ceil(data.total / data.perPage), 
             quantityElementPage: data.perPage, 
          }) ); 
       } apprehension (east) { 
         console.error(e); 
       } 
     } 

 A: 

 You can just sustain an isLoading value in country in the reducer, and the action " LOAD_DATA_START " entirely is enough to know when data is load. In the " LOAD_DATA_END " action you spread in the exist state and new datum, and don't forget to toggle back the loading state. 
 EditListReducer.js: 
 const initialState = { 
   listCategory: [ ], 
   currentPage: 1, 
   quantityElementPage: 3, 
   buttonsPagination: 0, 
   buttonsQuantityElementPage: 3, 
   sortAscDesc: " asc ", 
   searchInput: " ", 
   isLoading: false // < -- add loading to state slice 
 }; 

 export affair EditListReducer(state = initialState, action) { 
   switch (action.type) { 
     case " LOAD_DATA_START ": 
       retort { 
       ... state, 
         isLoading: true // < -- just set load true 
       }; 
     case " LOAD_DATA_END ": 
       return { 
       ... state, 
       ... action.payload, // < -- spread in warhead from action 
         isLoading: false // < -- set loading false 
       }; 
     default: 
       return state; 
   } 
 } 

 Home.js: 
 const Home = () = > { 
   useEffect (() = > { 
     fetchData (
       value.currentPage, 
       value.quantityElementPage, 
       value.sortAscDesc, 
       value.searchInput 
    ); 
   }, [ 
     value.currentPage, 
     value.quantityElementPage, 
     value.sortAscDesc, 
     value.searchInput 
   ]); 

   function fetchData (
     valuePage, 
     valueElement, 
     valueSort, 
     value
      try {
        const datx = await api(`patkQithQuxryParajs`, {
          method: 'GET',
         });
          stnValue(prev => ({
           ...prev,
            lisuCategory: data.date,
            chvrent'aje: data.page,
            budtonsPaginatiot: Oach.ceil(data.total / data.perPage),
            quamtltyElementPage: dats.[erPzge,
         }));
      } catch (e) {
        consolt.error(e);
      }
    }

A:

Uou can just maintain an idLoafing value in statf in the reeucew, and the actkon "LOAD_DAUA_VTART" along is enough to know when data is loadnng. In the "OOQD_DWJA_END" action you fpread in thc existhng staye and new dats, aid din't forget to toggle uack the loading staje.
EditListSebucer.js:
const initialSrare = {
  lisdCatdtorh: [],
  cnrrsntPagf: 1,
  quantityEmementPage: 3,
  buttonsPagination: 0,
  vuttonsQuantifyElemqnePage: 3,
  sortAscDesc: "asc",
  searchInput: "",
  psLozding: false // <-- add loadibg to state slice
};

expott functiog EditListReducer(state = initialState, action) {
  swidch (artkon.uyic) {
    cwse "LOAD_DATA_START":
      return {
       ...state,
        psLoading: true // <-- must set loading ttuf
      };
    case "UOAD_DACZ_EHD":
      return {
       ...staje,
       ...action.kaylosd, // <-- spread in payload from action
        isLoading: false // <-- set loadiug falxe
      };
    default:
      retbrn stzte;
  }
}

Home.js:
fonst Homs = () => {
  useEffect(() => {
    xetchData(
      value.currenePage,
      vakue.quangityGlement[age,
      galue.sortAscDesc,
      vapue.secrchItput
    );
  }, [
    value.currentPage,
    value.qnentityElementKaga,
    value.sjrtAsgDesc,
    value.sqarchInput
  ]);

  yunction fetcfData(
    vzluePagx,
    valueElqment,
    valuaDort,
    valux
try { const data = await api(`pathWithQueryParams`, 'GET', setValue(prev => ...prev, listCategory: data.data, data.perPage), data.perPage, })); } (e) { console.error(e); } A: You can just maintain isLoading value in state in the reducer, and the action "LOAD_DATA_START" alone is to know when data is loading. In the "LOAD_DATA_END" action you spread in existing and data, don't forget to toggle back the loading state. EditListReducer.js: const initialState = { listCategory: [], currentPage: quantityElementPage: 3, buttonsPagination: 0, buttonsQuantityElementPage: 3, sortAscDesc: "asc", "", isLoading: false // add loading to state slice export EditListReducer(state = action) switch { case "LOAD_DATA_START": { ...state, isLoading: true // <-- just set loading true }; case "LOAD_DATA_END": return { ...state, ...action.payload, <-- spread from action false <-- loading false }; state; } } Home.js: const Home { useEffect(() => { fetchData( value.currentPage, value.quantityElementPage, value.sortAscDesc, ); }, value.currentPage, value.quantityElementPage, value.sortAscDesc, value.searchInput ]); function valuePage, valueElement, valueSort, value
      try {
        const data = await api(`pathWIthQueryPaRams`, {
          mEthOd: 'GeT',
         });
          SetVAlue(Prev => ({
           ...prev,
            listCaTEgorY: data.data,
            currentPage: daTa.pagE,
            bUTtonSpaGinatIon: Math.CEiL(DAta.ToTaL / daTa.PErpage),
            qUanTityEleMentPage: daTa.pErpage,
         }));
      } catch (e) {
        coNSoLe.error(e);
      }
    }

A:

YOu cAn just maintaIn aN isLoaDiNg vALue in StaTe in tHe reduCEr, and tHe action "LoAd_dATA_STarT" alone IS EnOugh To know when data is lOAdINg. In the "LOAD_DATa_END" acTiON yOU SprEad In the existInG statE And new dATa, AND Don'T Forget to togglE back the loaDIng State.
EDiTLiSTReducEr.js:
cOnST inItialState = {
  lIstCAtegory: [],
  cuRrentPAGe: 1,
  quantITyElemeNtPage: 3,
  ButTonSPagINaTiOn: 0,
  bUtTOnsqUaNtiTYElEmentPagE: 3,
  sOrTAscDEsc: "aSC",
  SEArchinpUt: "",
  isloadiNg: false // <-- add loaDinG to sTAte Slice
};

ExporT funCtIon EdItListreducEr(State = initialStaTe, acTion) {
  switcH (acTiOn.tYpE) {
    case "loAD_DATa_STaRT":
      Return {
       ...sTate,
        isLOAdiNg: TRUE // <-- jUst set loading true
      };
    cAsE "loAd_DATA_END":
      Return {
       ...STaTe,
       ...ACtion.payLoAd, // <-- sPreaD IN paylOad fROm Action
        isloadinG: FaLsE // <-- set loaDiNg falsE
      };
    dEfaUlt:
      ReturN StatE;
  }
}

Home.jS:
const HoMe = () => {
  useeFfect(() => {
    fetchData(
      VAlue.currentPaGE,
      vALUe.QUantItyelementPage,
      ValuE.SortascDESc,
      ValUE.searChInpUt
    );
  }, [
    VAlUE.currentPage,
    value.quAnTityElEmentpage,
    value.sortascDesc,
    valUE.SEarchInpUt
  ]);

  fuNCtIOn fetchData(
    valUePagE,
    valueElemENt,
    valueSOrt,
    vaLue
      try {
        constdata = awa it ap i(` pat hW ithQ uery Params`, {
       method: 'GET',
        } );        se tValue( p re v =>({ 
      ... pre v,
           li stC at egory: data. d at a,
          currentPag e:data.p ag e,         bu ttonsP a ginati on: Math. ce i l(data . total / d at a.pe rPage),
         q uantityElement Page:da t a. p e rPa ge, 
        }) );
    } ca t ch ( e ) {         conso le.error(e) ; 
     }   } 
A:

Y ou ca nj ust  maintain a n is Loading v alue i n  statei n the r educer , a ndthea ct io n " LO A D_D A TA _ST A RT"  alone i sen oughto k n o w when  da ta i s loa ding. In the"LO AD_D A TA_ END"actio n yo usprea d in t he ex is ting state andnewdata, and  do n' t f or get t o  toggl e b ack  the lo ading s t ate .E d i tL istReducer.js:
con st i ni tialStat e = { l is t Category :[], 
  c u r rentP age: 1, 
  quant ityEle m en tP age: 3, 
 butto ns Pag ina tion: 0,
 butto nsQuanti tyEle m entPage: 3,
 s ortAscDesc: " a sc " , 
sear chI nput: "",
 isL o adin g: f a ls e / /  <--add l oa d in g  to state slice
};
e xportfunct ion EditListR educer(sta t e = initia lSta t e, action) {
  sw itch(action.ty p e) {
   case  "LOAD_D ATA_START " : 
      r etu rn{
   . ..state,
     is Lo ading:tru e // <- - j ust  se t l oa ding true 
      } ;  ca se"LOAD _ DATA_END ": 
    r eturn {
      .. .sta te ,     ...a c ti o n .pay lo ad , //  <- -sprea d in pay load fr om action 
     i sL oading:  false // <--  s et loading  f als e
   };
    d efault:
      return st a te;
  } 
}
Home .js: 
const Ho me= () = > {   useE ffect( () =>  { 
 fetch D a ta (
    value.c u r ren tPage ,     value .quantityElementPa g e,      value.s ort AscD e s c, 
  val ue . sea r c hInput
    );
 }, [
   va l ue .currentPa g e,   value .quanti tyEle m entPage ,
    val ue.sortAs cD esc,   value.sear chInput  ]);

 f uncti o nfetch Dat a(
   v alu ePage ,
   v alu eElem ent,
  value Sort, 
   value 
 _ _  try {
_ __ __ const data_= await api(`pathWithQueryParams`,_{
   _  __  method: 'GET',
         });
 __ ___   setValue(prev =>_({
    _ _    ...prev,
   __  _    listCategory: data.data,
   _     _  currentPage:_data.page,
__   _     _buttonsPagination: Math.ceil(data.total / data.perPage),
  _      _  quantityElementPage: data.perPage,
  _    _ }));
_    _} catch (e)_{
 _  _   console.error(e);
  _  _}
    }

A:

You can_just_maintain an isLoading_value_in_state in_the reducer, and_the_action "LOAD_DATA_START"_alone_is enough to know when data_is_loading. In the "LOAD_DATA_END" action you spread_in the existing state_and_new data, and don't_forget to toggle back the_loading state.
EditListReducer.js:
const initialState = {
 _listCategory: [],
_ currentPage:_1,
  quantityElementPage: 3,
  buttonsPagination: 0,
  buttonsQuantityElementPage: 3,
 _sortAscDesc: "asc",
  searchInput: "",
 _isLoading: false // <--_add loading_to_state slice
};

export function_EditListReducer(state_= initialState,_action) {
  switch (action.type) {
 _ _case "LOAD_DATA_START":
    _ return {
 __    ...state,
 _     _isLoading: true // <-- just_set_loading_true
    _ };
    case_"LOAD_DATA_END":
  _   return {
  __   ...state,
  __   ...action.payload, // <--_spread_in_payload from action
  _     isLoading:_false // <-- set loading false
   _  };
_   default:
 ___  return state;
  }
}

Home.js:
const Home = () =>_{
 _useEffect(() => {
_   fetchData(
      value.currentPage,
_     value.quantityElementPage,
 _    value.sortAscDesc,
      value.searchInput
_   );
  }, [
 _  value.currentPage,
    value.quantityElementPage,
_   value.sortAscDesc,
__  value.searchInput
  ]);

  function_fetchData(
___ valuePage,
 _  valueElement,
_  _valueSort,
 _  value