Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions patterns/15.list-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Lists and other things that are almost components

Instead of making a separate component for lists I can then generate the results like:
```javascript
const SearchSuggestions = (props) => {
// renderSearchSuggestion() behaves as a pseudo SearchSuggestion component
// keep it self contained and it should be easy to extract later if needed
const renderSearchSuggestion = listItem => (
<li key={listItem.id}>{listItem.name} {listItem.id}</li>
);
// renderSearchSuggestion() behaves as a pseudo SearchSuggestion component
// keep it self contained and it should be easy to extract later if needed
const renderSearchSuggestion = listItem => (
<li key={listItem.id}>{listItem.name} {listItem.id}</li>
);

const SearchSuggestions = (props) => {
return (
<ul>
{props.listItems.map(renderSearchSuggestion)}
Expand Down