re: No, I don't know what closures are...yet VIEW POST


I had to read how closures worked about 6 different times before I really understood them. Every time I would walk away thinking I got it, only to realize I couldn't really explain it. I think finding a need for it in my code was what finally made it break through for me. The same happened with currying and partial application.

This code is what finally got me to understand partial application:

    const openRenameModal = () => setModalMode(CONST.MODAL_MODES.RENAME);
    const openColorModal  = () => setModalMode(CONST.MODAL_MODES.COLOR);
    const openDeleteModal = () => setModalMode(CONST.MODAL_MODES.DELETE);

Putting something into practice can be a much easier way to learn that lots of "foo"s and "bar"s.

code of conduct - report abuse