vigetlabs / microcosm

Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.
http://code.viget.com/microcosm/
MIT License
487 stars 29 forks source link

microcosm-addons: manually pass payload to ActionForm #429

Closed nhunzaker closed 6 years ago

nhunzaker commented 6 years ago

For controlled forms, it would be great if you could pass in the payload for the form to send:

class ControlledForm extends React.Component {
  // ... controlled input stuff
  render() {
    return (
      <ActionForm action="thing" payload={this.state.formData}>
        <input type="text" onChange={this.onChange} />
      </ActionForm>
    )
  }
}

In this mode:

  1. The serializer prop would not be called.
  2. The prepare prop would be called