Sorting search results alphabetically
This commit is contained in:
parent
a24ce0fd58
commit
afc0ee7c43
|
@ -7,10 +7,13 @@ const SearchResults = (props) => {
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort array alphabetically
|
||||||
|
const sortedInterviews = props.data.sort((a, b) => { return a.name.localeCompare(b.name); });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="search-results">
|
<div className="search-results">
|
||||||
<ul>
|
<ul>
|
||||||
{ props.data.map(interview => (
|
{ sortedInterviews.map(interview => (
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
<li
|
<li
|
||||||
id={interview.id}
|
id={interview.id}
|
||||||
|
|
Loading…
Reference in New Issue