Skip to content

Instantly share code, notes, and snippets.

@kellyrmilligan
Last active September 13, 2017 14:13
Show Gist options
  • Select an option

  • Save kellyrmilligan/37b5f8cd3e1cc0eaaec7a80c3622081f to your computer and use it in GitHub Desktop.

Select an option

Save kellyrmilligan/37b5f8cd3e1cc0eaaec7a80c3622081f to your computer and use it in GitHub Desktop.

Revisions

  1. kellyrmilligan revised this gist Sep 13, 2017. 1 changed file with 3 additions and 7 deletions.
    10 changes: 3 additions & 7 deletions loopingthroughlistsreact
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,9 @@
    const List = ({ items, onClick }) => (
    <ul>
    {items.map(item => (
    <ClickHandler key={item.id} data={item} onClick={onClick}>
    {(handleClick) => (
    <li onClick={handleClick}>
    {question.text}
    </li>
    )}
    </ClickHandler>
    <li>
    {item.text}
    </li>
    ))}
    </ul>
    )
  2. kellyrmilligan created this gist Sep 13, 2017.
    13 changes: 13 additions & 0 deletions loopingthroughlistsreact
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    const List = ({ items, onClick }) => (
    <ul>
    {items.map(item => (
    <ClickHandler key={item.id} data={item} onClick={onClick}>
    {(handleClick) => (
    <li onClick={handleClick}>
    {question.text}
    </li>
    )}
    </ClickHandler>
    ))}
    </ul>
    )