Render array of inputs in react

后端 未结 3 1989
孤独总比滥情好
孤独总比滥情好 2021-02-19 08:04

I have an array of emails (as a part of a bigger model). These are displayed in seperate rows witha remove button for each (the address itself can be updated in the input box d

3条回答
  •  迷失自我
    2021-02-19 08:27

    You should place your Array.map directly inside your render() function. Just take care that each array element is wrapped inside a parent element (

    here) and must have a unique key={}

    class ArrayMap extends React.Component{
      //your functions
      handleEmailChanged(key){
        // Handle email
      }
      render(){
        return(
          
    { this.data.emailGroup.emails.map((email) => {
    }); }
    ); } }

提交回复
热议问题