DeleteUser component

The DeleteUser component in client/user/DeleteUser.js is basically a button that we will add to the Profile view, which when clicked opens a Dialog component asking the user to confirm the delete action: 

The component first initializes the state with open set to false for the Dialog component, and redirect also set to false so it isn't rendered first.

mern-skeleton/client/user/DeleteUser.js:

class DeleteUser extends Component {  state = { redirect: false, open: false } ...

Next, we need handler methods to open and close the dialog button. The dialog is opened when the user clicks the delete button.

mern-skeleton/client ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.