How to change message based on the id

I have some requirements in react js like, I have a number of the array is there. I have a button and if I clicked the button I am passing some number. I want to check if whatever I passed that number is available inside an array or not. if available print “Deleting” else Print “Deleted”. Here is the sample code

import React, { Component } from 'react';

class Table extends Component {
   constructor(props){
      super();     
      this.state = {
         numbers:[1, 2, 3, 4, 5],
      };
   } 

    delete = function(id) {

    }

   render() { 
     return (
         <div>
            // Here i want to chcek if the the number is available inside array or not
            // if available print "Deleting" else "Deleted"

            <button onClick={() =>this.delete(5)}>Click</button>
         </div>
      )
   }
}

export default Table 

inside i want to print the message “deleting” or “deleted”.If the number is available inside array print “Deleting” else print “Deleted”. “ Here I attached a screenshot, in this way I want the output.enter image description here

Answer

You can using includes to check number is available inside an array or not

delete = function(id) {
  this.setState({id})
}

...

<span>{ this.state.numbers.includes(this.state.id) ? "Deleting" : "Deleted" }</span>
<button onClick={() =>this.delete(5)}>Click</button>