Answer the question
In order to leave comments, you need to log in
How to collect data into an object on input click?
I output the following input:
render () {
const { id, name, value, adress } = this.props
return (
<p className="adressPoint">
<input type="radio" className="radio" id={ id } name={ name } value={ value } onChange = { e => this.handleChangeOffice ( e ) } />
<label htmlFor = { id } > { adress } </label>
</p> </b>
)
}
}
handleChangeOffice (e) {
const { getIdAndOffice } = this.props;
const id = e.target.name;
console.log(id);
const idAndOffice = this.state.radioValue
console.log(idAndOffice);
idAndOffice[id]= e.target.value;
console.log(idAndOffice);
this.setState({
radioValue: idAndOffice
});
console.log(this.state.radioValue)
this.props.getIdAndOffice(this.state.radioValue)
console.log(this.props.getIdAndOffice(this.state.radioValue))
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question