-1

I don't know why when I start my server, the error modal say 'data is not defined'. But I defined the data content.

export default class App extends Component {
  data = [
    {
      key: "john",
      value: "John Doe",
    },
    {
      key: "jane",
      value: "Jane Doe",
    },
    {
      key: "mary",
      value: "Mary Phillips",
    },
    {
      key: "robert",
      value: "Robert",
    },
    {
      key: "karius",
      value: "Karius",
    },
  ];

  render() {
    return (
      <ReactSearchBox
        placeholder="Search for John, Jane or Mary"
        data={data}
        onSelect={(record) => console.log(record)}
        onFocus={() => {
          console.log("This function is called when is focussed");
        }}
        onChange={(value) => console.log(value)}
        fuseConfigs={{
          threshold: 0.05,
        }}
        value="John"
      />
    );
  }
}
VLAZ
  • 26,331
  • 9
  • 49
  • 67

1 Answers1

0

you need to add const before data.

Sima Amini
  • 331
  • 2
  • 10