change reducer state from other reducer

Clash Royale CLAN TAG#URR8PPP
change reducer state from other reducer
This might be anti pattern but what I need to do is change another reducers state from other reducer. Not just access .
I need this because of redux-from , basically I have to clear components form value , In my reducer I catch
case "@@redux-form/CHANGE":
if (action.meta.form === "XXX") ..
And process the value as I needed. According to my calcs I need to change components forms value which resides in
form: reducerForm,
Thanks in advance
1 Answer
1
You can listen to the same action in both your reducers, and modify both of them.
This is not an anti-pattern, it's even recommended in the redux doc.
reducerA
case "@@redux-form/CHANGE":
if (action.meta.form === "XXX") ..
reducerB
case "@@redux-form/CHANGE":
if (action.meta.form === "XXX") ..
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Redux-from allow you to write simple plugins to extend standard reducer , if follow this approach I have to write all ui managing logic inside of my combine reducer function which is of course not a good idea. Keeping form state in store would give me the abstraction but not at this cost . It is time to give up redux-from I guess and use simple formik. Thanks anyway
– atmosfer
Aug 12 at 10:14