Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: exporting wrapped components #1

Closed
oreqizer opened this issue May 30, 2016 · 5 comments
Closed

Idea: exporting wrapped components #1

oreqizer opened this issue May 30, 2016 · 5 comments

Comments

@oreqizer
Copy link

The flow would then become:

import { WrappedTextField } from 'redux-form-material-ui';

const MyForm = props =>
  <form onSubmit={props.handleSubmit}>
    <Field
      name="username"
      component={WrappedTextField}
      floatingLabelText="Username"
    />
  </form>;

export default reduxForm({
  form: 'myForm',
})(MyForm);

This allows for a better tree shaking with webpack2, is more explicit and less error prone in my opinion (no string component matching).

@erikras
Copy link
Owner

erikras commented May 30, 2016

Those are good arguments against the "adapter" API, which was somewhat conceived in a late night coding binge. How about naming?

WrappedTextField

ReduxFormTextField / RfTextField

or just...

import { RadioButtonGroup, TextField } from 'redux-form-material-ui';
import  { RadioButton } from 'material-ui';

@oreqizer
Copy link
Author

oreqizer commented May 30, 2016

I would simply name it the way material-ui has it. Less overhead to keep in mind, and I don't think it would confuse anyone if they keep their form and field usage consistent (meaning they stick to redux-form and material-ui).

I will create a PR once I'll have some free time if you don't mind

@erikras
Copy link
Owner

erikras commented May 30, 2016

To be clear, you're voting for Option 3?

import { RadioButtonGroup, TextField } from 'redux-form-material-ui';
import  { RadioButton } from 'material-ui';

@oreqizer
Copy link
Author

yep

@erikras
Copy link
Owner

erikras commented May 30, 2016

Great suggestion. Released as v2.0.0.

@erikras erikras closed this as completed May 30, 2016
erikras pushed a commit that referenced this issue Dec 30, 2016
* Allow onChange from field in Slider.js (#1)

Accept onChange function from declaration within <Field> component.

* Complete slider refactor to allow onChange to be passed by Field, update example Form.js to show use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants