survivejs / react-book

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

Implementing a Note Application - #413

Open ggirton opened 8 years ago

ggirton commented 8 years ago

I found the syntax in this part not explained. After the 1st curly brace It is going into javascript with notes.map, but then it goes back out when it hits the

  • list item? Not sure what's going on there, just thought I'd mention. The book is excellent so far, this is the 1st puzzling thing I hit. (Altho there were 6 deprecated packages you're using when I brought in the latest node. Well, things change :-) )

    export default () => (

      {notes.map(note =>
    • {note.task}
    • )}

    )

  • bebraw commented 8 years ago

    You mean

    export default () => (
      <ul>{notes.map(note =>
        <li key={note.id}>{note.task}</li>
      )}</ul>
    )

    right in the start? The curlies come from JSX. That's why I have those bullets right below the code example but I don't mind improving this. đź‘Ť

    Good point about deprecations. I can fix some of that but not everything. It all moves so fast in the Node world.

    ggirton commented 8 years ago

    Thank you! By the way, I had a one-hour duration time looking up the following phrase

    () =>

    it is very hard to google for! (and not an idiom in the FB React docs, at least in the beginning)

    Finally I found this summary which not only explained it, but also included the incredible humorous "n goes to zero” example. Ha ha!

    https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/

    and also suggested Turing-related lambda function investigations. Wow!

    Cheers!

    On Jun 21, 2016, at 9:36 PM, Juho Vepsäläinen notifications@github.com wrote:

    You mean

    export default () => ( < ul>{notes.map(note =>

  • {note.task}
  • )}</ul

    )

    right in the start? The curlies come from JSX. That's why I have those bullets right below the code example but I don't mind improving this. đź‘Ť

    Good point about deprecations. I can fix some of that but not everything. It all moves so fast in the Node world.

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

    bebraw commented 8 years ago

    By the way, I wrote a language feature appendix to cover these sort of questions. I probably should link there in the text.

    ggirton commented 8 years ago

    Yes, there were multiple references to it and, ha ha ha, finally I went there and started reading it :-) I don’t think you need to put in a link but mention “ This is an Arrow function explained in the appendix” … good to go :-)

    On Jun 21, 2016, at 9:57 PM, Juho Vepsäläinen notifications@github.com wrote:

    By the way, I wrote a language feature appendix to cover these sort of questions. I probably should link there in the text.

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.