如何解决此错误:TypeError: this.state is not a function

Wat*_*tos 0 javascript reactjs

我无法解决这个问题,我该如何解决这个问题?

import React, { Component } from "react";
import "./Main.css";
import { FaSearch, FaEdit, FaWindowClose } from "react-icons/fa";

export default class Main extends Component {
  state = {
    pesquisaNFE: "",
    resultado: [],
  };

  handleSubmit = (e) => {
    e.preventDefault();
    const { resultado } = this.state;
    let { pesquisaNFE } = this.state;
    pesquisaNFE = pesquisaNFE.trim();

    if (resultado.indexOf(pesquisaNFE) !== -1) return;

    const newSearch = [...resultado];

    this.state({
      resultado: [...newSearch, pesquisaNFE],
    });
  };
Run Code Online (Sandbox Code Playgroud)

错误:

在此输入图像描述

Shm*_*uer 5

要更新状态,您需要调用this.setState

改成this.state({this.setState({