survivejs / react-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/react/introduction/
2.02k stars 366 forks source link

[4.3 - pap/components/Notes.jsx] -"onDelete... dummy callback" question #437

Closed JESii closed 2 years ago

JESii commented 7 years ago

After you update Notes.jsx with the delete functionality, you say:

"I defined a dummy callback for it [onDelete]."

I believe this is referring to the line: export default ({notes, onDelete=() => {}})

This is probably picking nits, but the way I see it, there's actually no callback function defined, dummy or otherwise -- what I would call this is just defining an empty function so that onDelete is defined (i.e., not null), even if it is not provided by the caller.

bebraw commented 7 years ago

Technically it will trigger onDelete even if it's provided an empty function. I might have to rethink the section to eliminate the function. Thanks for bringing this up.