material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

Custom input props for TextField

Open totopia opened this issue 11 years ago • 3 comments

I am trying to pass some custom input props to Textfield,

seeing the source here: https://github.com/callemall/material-ui/blob/master/src/text-field.jsx#L241 But I am not sure what {... does....is it using the local var values on Parent element or it is taking the inputProps as a prop I can set as part of

totopia avatar May 15 '15 17:05 totopia

... is the spread operator. React's implementation takes the properties of the object and expands them into component properties. It is used to handle all possible component properties that may or may not be getting used in any instance.

https://facebook.github.io/react/docs/jsx-spread.html

troutowicz avatar May 15 '15 17:05 troutowicz

i see...interesting. I see that allowed me to use TextField just like another , and it knows to pass the props to the input inside the component. Pretty awesome trick.

totopia avatar May 15 '15 19:05 totopia

Thanks @troutowicz

hai-cea avatar Jun 03 '15 22:06 hai-cea