A seasoned full-stack developer. I love WordPress, React and modern JavaScript, Nodejs and PHP development. Created https://wpack.io to bridge the gap between WordPress and Modern JavaScript.
Thank you very much for this. I would like to add that I am using immer with zustand
import{create}from'zustand';import{redux,devtools}from'zustand/middleware';import{produce}from'immer';typeMyReducerStateType={count:number;}functionmyReducer(state:MyReducerStateType,action:'increase'|'decrease'){returnproduce(state,draftState=>{switch(action){case'increase':draftState.count=state.count+1;break;case'decrease':draftState.count=state.count-1;break;default:thrownewError('Invalid action type');}});}// create store with zustandconst[useStore]=create(devtools(redux(myReducer,{count:0,})));// as given by redux middlewareconstdispatch=useStore(store=>store.dispatch);
This has drastically reduced my reducer logics.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you very much for this. I would like to add that I am using immer with zustand
This has drastically reduced my reducer logics.