Skip to content

Instantly share code, notes, and snippets.

@francisngo
Created December 30, 2017 00:50
Show Gist options
  • Save francisngo/988950adf35b5f55fce06943f112d91e to your computer and use it in GitHub Desktop.
Save francisngo/988950adf35b5f55fce06943f112d91e to your computer and use it in GitHub Desktop.
Collection for Redux todo example - This file is the presentational component for List
import React, { Component } from 'react';
export default class List extends Component {
renderItem(text, i) {
const { onClickItem } = this.props;
return (
<div onClick={() => onClickItem(i)}>{text}</div>
);
};
render() {
const { list } = this.props;
return (
<div>
{ list.map(this.renderItem.bind(this))}
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment