react-multi-email
react-multi-email copied to clipboard
Mutation on remove
Following code mutates the emails, which leads my state to be corrupted:
https://github.com/jsdevkr/react-multi-email/blob/c45542748e750757b5c27a6aec6f2c1aa6680584/src/react-multi-email/ReactMultiEmail.tsx#L109
this code should be correct:
removeEmail = (index: number) => {
this.setState(prevState => ({
emails: prevState.emails.splice(index, 1),
}), () => {
if (this.props.onChange) {
this.props.onChange(this.state.emails)
}
})
}
Thank you. I will fix this code.
Version 0.4.0 has just been released. Thank you again.
v0.4.1 has just been released. Thank you again.