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
<input .....><button onClick=....>
so I insert the text in input, after clicking the button the text.split(" ")
everything works correctly till here. but in the button group part shows nothing
<div className="btn-group" role="group" aria-label="...">
{this.mapArrayToButtons()}
</div>
mapArrayToButtons(){
this.state.textArr.map((word)=>{
console.log('the word: ',word);
return(<button key={word} type="button" className="btn btn-default" value={word}>{word}</button>);});
}
I see console log textArr.length
times and word by word. but no button is rendered and nothing shows in the browser.