Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. I figured it out. I inadvertently had the wrong order for how the components were wrapped. Instead of connect()ing the reduxForm()'ed component, I was reduxForming the connect()ed component.
  2.  
  3. Wrong:
  4.  
  5. reduxForm(formOptions)(connect(mapStateToProps, mapDispatchToProps)(form))
  6. Correct:
  7.  
  8. connect(mapStateToProps, mapDispatchToProps)(reduxForm(formOptions)(form))
  9. In other words, reduxForm and connect do not commute!
  10.  
  11. Suggestion: add a note to the documentation to make this clear. The example does it correctly, but doesn't point out that it works only in this order.
  12.  
  13. The upgrade guide simply states: 'You will need to separately decorate your form component with connect() yourself if you need to access other values in the Redux store or bind action creators to dispatch.' which doesn't make the order clear.
  14.  
  15. This could be a problem in particular for people migrating from v5 where, apparently, the order didn't matter (?).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement