reducers - How to update the state in redux without using mapDispatchToProps() method -


i trying update reducer state using : store.dispatch(nameofthereducer(data)).

it calls action creator not update reducer state. dont want create react component want dispatch state change. there way so..thanks in advance

i think misunderstood how component , redux state relates.

redux state change done through actions regardless of component 'using' state.

as long have action creator defined somewhere, , reducer handle corresponding action.type, can use action creator in whichever component.

there no benefit of using store directly. store stored in context, , considered bad practice using context. nice thing redux takes care of giving provider , connect.

except when initializing app, should use mapdispatchtoprops when want use action creators in component.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -