“renderowanie tekstu dla pętli React w funkcji” Kod odpowiedzi

React for Loop in Render

render: function() {
  const elements = ['one', 'two', 'three'];
  return (
    <ul>
      {elements.map((value, index) => {
        return <li key={index}>{value}</li>
      })}
    </ul>
  )
}
Bad Booby

renderowanie tekstu dla pętli React w funkcji

myLoopFunction() {
    var myArray = [];
    var i;
    for (i = 0; i < this.state.events.length; i++) {
      myArray[i] = (
        <Event
          time={this.state.events[i].time}
          title={this.state.events[i].title}
        />
      );
    }
    return myArray;
  }
Breakable Bee

Odpowiedzi podobne do “renderowanie tekstu dla pętli React w funkcji”

Pytania podobne do “renderowanie tekstu dla pętli React w funkcji”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu