Let’s add a modal window to the Words
container.
First, let’s add the logic to enable it.
Let’s create its state with useState
. The initial value is an object with fields:
visible
with the value false
, title
is an empty string, handleDelete
is null.
Next, add the getVisibleModalData
method in the file: src/containers/Words/helpers.js
.
The method must have three arguments: name
, deleteHandler
, setModalParams
.
The last one is the method from the useState
called above.
This function should call the setModalParams
method and pass an object with fields to it:
-visible
equal to true
;
-title
equal to Are you sure you want to delete "${name}"?
, where name is the argument described above
-handleDelete
equal to the function that first calls deleteHandler
with the argument name
, and then setModalParams
with the initial value of useState
.
The AlertModal
component itself must be added after the RadialButton
.
The properties visible
, title
, handleDeleteClick
must be taken from the state object above.
The handleClose
property must set the initial value of useState
.
This task is part of the Full-Stack JavaScript Course.
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.