Skip to content

Instantly share code, notes, and snippets.

@kyleparisi
Created December 5, 2017 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyleparisi/4567b24bd03fbfc65289735eb3127e86 to your computer and use it in GitHub Desktop.
Save kyleparisi/4567b24bd03fbfc65289735eb3127e86 to your computer and use it in GitHub Desktop.
class RenderItemWithKeyAndHandlers extends Component {
  render() {
    return this.props.renderListItem(this.props.data);
  }
}

and then

<ul>
{Object.keys(this.state.data).map(key => {
  return (
    <RenderItemWithKeyAndHandlers
      key={key}
      data={path(["data", key], this.state)}
      renderListItem={this.props.renderListItem}
    />
  );
})}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment