Book Image

Full Stack Development with Spring Boot 3 and React - Fourth Edition

By : Juha Hinkula
5 (1)
Book Image

Full Stack Development with Spring Boot 3 and React - Fourth Edition

5 (1)
By: Juha Hinkula

Overview of this book

If you’re an existing Java developer who wants to go full stack or pick up another frontend framework, this book is your concise introduction to React. In this three-part build-along, you’ll create a robust Spring Boot backend, a React frontend, and then deploy them together. This new edition is updated to Spring Boot 3 and includes expanded content on security and testing. For the first time ever, it also covers React development with the in-demand TypeScript. You’ll explore the elements that go into creating a REST API and testing, securing, and deploying your applications. You’ll learn about custom Hooks, third-party components, and MUI. By the end of this book, you'll be able to build a full stack application using the latest tools and modern best practices.
Table of Contents (23 chapters)
Part I: Backend Programming with Spring Boot
Part II: Frontend Programming with React
Part III: Full Stack Development
Other Books You May Enjoy

Adding the delete functionality

Items can be deleted from the database by sending the DELETE method request to the http://localhost:8080/api/cars/{carId} endpoint. If we look at the JSON response data, we can see that each car contains a link to itself, which can be accessed from the _links.self.href node, as shown in the following screenshot:

Figure 13.8: Car link

We already used the link field in the previous section to set a unique ID for every row in the grid. That row ID can be used in deletion, as we will see later.

The following steps demonstrate how to implement the delete functionality:

  1. First, we will create a button for each row in the MUI DataGrid. When we need more complex cell content, we can use the renderCell column property to define how a cell’s contents are rendered.

    Let’s add a new column to the table using renderCell to render the button element. The params argument that is passed to the function is a row object that...