christianalfoni / formsy-react

A form input builder and validator for React JS
MIT License
2.6k stars 438 forks source link

Make Formsy stateless #283

Open rodryquintero opened 8 years ago

rodryquintero commented 8 years ago

Abstract state from the form so to make it easier to implement as stateless components, in a way that plays nicely with Flux libraries like Redux.

What do you think?

clayne11 commented 8 years ago

+1 - I would love this.

jaraquistain commented 8 years ago

If this were the case I'd definitely be using it over redux-form in my new app refactor

makstr commented 8 years ago

+1

tylercollier commented 8 years ago

+1

aight8 commented 8 years ago

What's the benefit of storing the forms state in the redux store? I don't get this 100%. Isn't that a little bit an overkill? I ask because the form-redux project facing performance issues since all store subscribers are notified on every change except you use Immutables everywhere etc. When you forget somewhere to optimize the shouldUpdate function it automatically cause serious performance issues. Or have I overlooked something?

clayne11 commented 8 years ago

You should never mutate state, especially when using redux. That's one of redux's core principles.

One of the huge advantages to storing form state in the redux store is conditional forms. When the form items you display are dependent on values that are currently filled out in the form it is easy to determine what to show when the form state comes in from props. When you have to pull state out of the components or store a copy of the state in the current component you're working on things get messy and extremely coupled.