javascript React map이차원배열및객체로표시(array and object)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript React map이차원배열및객체로표시(array and object)相关的知识,希望对你有一定的参考价值。

import React, { Component } from "react";

function getNumbers() {}

class NumberBaseball extends Component {
  state = {
    result: "",
    value: "",
    answer: getNumbers(),
    tries: []
  };

  onSubmitForm = () => {};

  onChangeInput = () => {};

  render() {
    return (
      <>
        <h1>{this.state.result}</h1>
        <form onSubmit={this.onSubmitForm}>
          <input
            maxLength={4}
            value={this.state.value}
            onChange={this.onChangeInput}
          />
        </form>
        <div>시도: {this.state.tries.length}</div>
        <ul>
          {[["사과", "맛있다"], ["바나나", "맛없다"]].map(v => (
            <li>
              <b>{v[0]}</b> - {v[1]}
            </li>
          ))}
        </ul>
      </>
    );
  }
}

export default NumberBaseball;
import React, { Component } from "react";

function getNumbers() {}

class NumberBaseball extends Component {
  state = {
    result: "",
    value: "",
    answer: getNumbers(),
    tries: []
  };

  onSubmitForm = () => {};

  onChangeInput = () => {};

  render() {
    return (
      <>
        <h1>{this.state.result}</h1>
        <form onSubmit={this.onSubmitForm}>
          <input
            maxLength={4}
            value={this.state.value}
            onChange={this.onChangeInput}
          />
        </form>
        <div>시도: {this.state.tries.length}</div>
        <ul>
          {[
            { fruit: "사과", taste: "맛있다" },
            { fruit: "감", taste: "시다" }
          ].map(v => (
            <li>
              <b>{v.fruit}</b> - {v.taste}
            </li>
          ))}
        </ul>
      </>
    );
  }
}

export default NumberBaseball;

以上是关于javascript React map이차원배열및객체로표시(array and object)的主要内容,如果未能解决你的问题,请参考以下文章

text React배열렌더링(数组渲染)

javascript 争论를배열로만들기(Javascript)

javascript 反应배열복사하여수정

javascript Javascript删除特定阵列(자바스크립트에서배열요소삭제)

javascript 코인원채팅메시지개수줄이기

Audi ATOM 컨셉트카~