reactjs; after mapping an array nothing renders

后端 未结 3 1446
长情又很酷
长情又很酷 2021-01-15 10:58

I have an input that after the user inserts a text I want to show each word in a button in button-group. I split the sentence and map it that returns



        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-15 11:55

    try this

    mapArrayToButtons(){
        const buttons = this.state.textArr.map((word)=>{
            console.log('the word: ',word);
            return();});
        return buttons;
    
    }
    

提交回复
热议问题