zapier/formatic — pull request #8 by jdeal (2014-08-21 19:11:19+00:00)
Title: Took away bound onChange, added unbound actions.

@bryanhelmig Heads up. I decided the `actions('focus')` thing from yesterday was not appropriate for performance reasons.

I had known `this.props.onChange` was a bit of a performance concern, since there's a re-binding for every render call of every component. I'm pretty liberal with `bind`, and I don't want to worry too much about performance, but a busy page could produce a lot of function garbage. Adding in other things like focus, blur, etc. would multiply that problem. (Just to clarify, the simple `onChange: this.onChange` style requires the handler to be bound to the field.)

Instead, I've added the ability to declare actions like `formatic.action('foo')`, and the actions are only bound to the form. You have to supply the context, so you have to do something more verbose like:

```js
React.createClass({
onFocus: function () {
this.props.form.actions.focus(this.props.field);
},
render: function () {
return R.input({onFocus: this.onFocus}, ...);
}
});
```

I use a mixin to wipe some of that away. Can maybe expose that as part of the reactViewer plugin.