reactjsでUncaught Error: Invariant Violation: processUpdates();エラー

ReactjsでTodoリストのようなものを作って削除処理でsetStateするとエラーが発生

Uncaught Error: Invariant Violation: processUpdates(): Unable to find child 8 of element. This probably means the DOM was unexpectedly mutated (e.g., by the browser), usually due to forgetting a <tbody> when using tables, nesting tags like <form>, <p>, or <a>, or using non-SVG elements in an <svg> parent. Try inspecting the child nodes of the element with React ID `.0.3.0.1`

エラー通り、tableタグにtheadとtbodyをつけてなかったのが原因でした

var jobBox = React.createClass({
  onJobDelete(id) {
    this.props.onJobDelete(id);
  },
  render() {
    var jobLines = this.props.jobs.map((job, i) => {
      return <JobLine key={i} onDelete={this.onJobDelete} job={job} />;
    });

    return (
      <div>
        <table>
        <thead>
          <tr>
            <th>注文No.</th>
            <th>部品名</th>
          </tr>
        </thead>
        <tbody>
          {jobLines}
        </tbody>
        </table>
      </div>
    );
  }
});

一部ですがこんな感じです
theadとtbodyがないとDOM操作ができないようでした

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください