title: Spring boot, react how to delete entity of specific id?
body: <p>I'm trying to make a simple CRUD app. I'd like to delete a student of a specific id but I'm getting 400 error.
  My controller class in Spring boot looks like this:</p>
  <pre><code>@DeleteMapping(&quot;/student/delete/{id}&quot;)
  public String deleteById(@PathVariable int id){
          studentService.deleteStudentById(id);
          return &quot;Student deleted&quot;;
  }
  </code></pre>
  <p>In React my delete function looks like this:</p>
  <pre><code>    const handleDelete = (id) =&gt; {
      fetch(&quot;http://localhost:8080/student/delete/{id}&quot;, {
          method: &quot;DELETE&quot;,
          headers: {&quot;Accept&quot;:&quot;application/json&quot;, &quot;Content-Type&quot;:&quot;application/json&quot;}
      }).then(() =&gt; {
          let updatedStudents = [...students].filter(i =&gt; i.id !== id);
          setStudents(updatedStudents);
      });
  }
  </code></pre>
  <p>In my app I'm rendering students from MySQL database, each one with uniqe id. Each student has a delete button with onClick function =&gt; handleDelete.
  Where can be the problem?</p>