Sorting search results alphabetically

This commit is contained in:
Sharyn 2018-07-10 13:43:25 +02:00
parent a24ce0fd58
commit afc0ee7c43
1 changed files with 4 additions and 1 deletions

View File

@ -7,10 +7,13 @@ const SearchResults = (props) => {
return <div>Loading...</div>;
}
// sort array alphabetically
const sortedInterviews = props.data.sort((a, b) => { return a.name.localeCompare(b.name); });
return (
<div className="search-results">
<ul>
{ props.data.map(interview => (
{ sortedInterviews.map(interview => (
// eslint-disable-next-line
<li
id={interview.id}