reactjs - Avoiding mutiple refs to props in component -


a typical component duplicate props, there best practice props once component? rather set them again in submitform()

class screen3 extends component {   constructor() {     super();     this.submitform = this.submitform.bind(this);     this.onchange = this.onchange.bind(this);   }    submitform(e) {      const age = this.props.age;     const gender = this.props.gender;     const ethnicity = this.props.ethnicity;      ....   }    onchange(e) {     const field = e.target.name;     const value = e.target.value;      ...   }    render() {     let { age, gender, ethnicity } = this.props;     ....   const mapstatetoprops = store => {   return {     age: store.userdetails.age,     gender: store.userdetails.gender,     ethnicity: store.userdetails.ethnicity    }; }; 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -