I like the idea of refactoring, but I think step 4 using the object rest/spread operator to pass multiple props is an anti pattern. While prop spreading is convenient and saves typing, what specific props are being passed through? What props is <TextInput> supposed to support? If I needed to refactor <TextInput> using something other than <input> how would I know what props to support?
Yes @christianschulze
what you said is correct. rest/spread operator only suits for this example. My intention is first it will save typings and next i thought it is more readable. By seeing that snippet once can understand we are using label prop for label and rest of the props for input
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I like the idea of refactoring, but I think step 4 using the object rest/spread operator to pass multiple props is an anti pattern. While prop spreading is convenient and saves typing, what specific props are being passed through? What props is
<TextInput>
supposed to support? If I needed to refactor<TextInput>
using something other than<input>
how would I know what props to support?Yes @christianschulze what you said is correct. rest/spread operator only suits for this example. My intention is first it will save typings and next i thought it is more readable. By seeing that snippet once can understand we are using
label
prop for label and rest of the props forinput