Created
January 18, 2020 14:12
-
-
Save lior-amsalem/fef9a57015abcda94dd2c021f0565a62 to your computer and use it in GitHub Desktop.
Dynamically generated inputs - part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleChangeOfCatDataFactory = (type, itemIndex, generateKey) => (event) => { | |
const catData = event.target.value; | |
this.setState((prevState) => { | |
const newCatList = [...prevState.catList]; | |
newCatList[itemIndex] = { | |
...prevState.catList[itemIndex], | |
generateKey: generateKey, | |
[type]: catData, | |
}; | |
const showNewField = this.shouldCreateAdditionalFields(newCatList); | |
return { | |
...prevState, | |
catList: newCatList, | |
showNewField, | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment