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)
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({}) {} }
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
onI 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 writtenvalue: 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 forfunction({}) { 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..