【JavaScript】Bind onClick to the node generated by multiple createElement and make it a unique Click event

【JavaScript】Bind onClick to the node generated by multiple createElement and make it a unique Click event

background

I refactored the Yasushi code
Yasu is making a to-do list
but he has some problem.

Requirements
If you press the "Add button" with the text added to input.value
Show that text and delete button below

Todo item can be deleted by pressing the delete button

Even if you press the delete button that is bound to the generated dom, he cannot refer the specific deletion target

https://codesandbox.io/embed/musing-blackwell-vr37p?fontsize=14&hidenavigation=1&theme=dark

I fixed the passing of that id

TODO app meets requirements

https://codesandbox.io/s/headless-wood-iuc0d?fontsize=14&hidenavigation=1&theme=dark

let id = 1;
input.onclick = ((id) => () => {
 event.preventDefault();
 deleate(id) 
})(id)

but,
I just thought something was wrong and fixed it further

I feel like I can make it a little easier