redux-form-material-ui
redux-form-material-ui copied to clipboard
helperText is not a valid property on the material-ui Select in next
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
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({}) {} }
same issue here. Any solutions to this?
It seems, helperText
is part of MUI not part of this library. Could you double check ?
https://github.com/erikras/redux-form-material-ui/issues/208 seems related
same here..