erikras / redux-form-material-ui

A set of wrapper components to facilitate using Material UI with Redux Form
http://erikras.github.io/redux-form-material-ui/
MIT License
831 stars 228 forks source link

helperText is not a valid property on the material-ui Select in next #187

Open bmmathe opened 7 years ago

bmmathe commented 7 years ago

When making a Select field required I get the error below. In mapError.js helperText is being set if there is an error. This works for most of the components but Select no longer has a helperText.

Warning: Unknown prop helperText on

tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop in div (created by Input) in Input (created by withStyles(Input)) in withStyles(Input) in Select (created by withStyles(Select)) in withStyles(Select) (created by ReduxFormMaterialUIStyle) in ReduxFormMaterialUIStyle (created by ConnectedField) in ConnectedField (created by Connect(ConnectedField)) in Connect(ConnectedField) (created by Field) in Field (created by ContactForm) in div (created by FormControl) in FormControl (created by withStyles(FormControl)) in withStyles(FormControl) (created by ContactForm)

bmmathe commented 7 years ago

I was looking at different ways to work around this or provide an option to send in a helperText but something got me caught up in the Select.js file. There is syntax that is blowing my mind and I can't seem to get a simple codepen working to help me understand what is going on.

Essentially the Select.js file is structured like this: createComponent(Select, ({}) => ({}));

My question is, what is this doing? ({}) => ({}) or can someone shoot me a link to help me understand what syntax this is. I know it's an arrow function which I'm familiar with but typically the syntax is: var x = () => {}. I have never seen an arrow function being used for an input parameter before.

My next question is, it looks like the values on the left are being spread somehow but I don't see a spreader operator. The reason I say this is because on the right is this line value: value which I would have assumed should have been written value: input.value. I'm obviously missing something.

EDIT: after more research it looks like createComponent takes in a mapProps argument. Presumably this is a function because of ...mapProps(this.props). So does that mean ({})=>({}) this syntax is shorthand for function({}) { return function({}) {} }

PharrellWANG commented 6 years ago

same issue here. Any solutions to this?

mihirsoni commented 6 years ago

It seems, helperText is part of MUI not part of this library. Could you double check ?

thehig commented 6 years ago
kaleem-elahi commented 6 years ago

same here..