react-bits
react-bits copied to clipboard
List components
https://vasanthk.gitbooks.io/react-bits/patterns/32.list-components.html
I suggest putting that list item mapping function above SearchSuggestions component definition like below:
const renderSearchSuggestion = listItem => (
<li key={listItem.id}>{listItem.name} {listItem.id}</li>
);
const SearchSuggestions = (props) => {
return (
<ul>
{props.listItems.map(renderSearchSuggestion)}
</ul>
);
};
That way we do not create a new function each time SearchSuggestions rerenders.