react sort list alphabetically code example

Example 1: javascript sort alphabetically

var items = ['réservé', 'premier', 'communiqué', 'café', 'adieu', 'éclair'];
items.sort(function (a, b) {
  return a.localeCompare(b); //using String.prototype.localCompare()
});

// items is ['adieu', 'café', 'communiqué', 'éclair', 'premier', 'réservé']

Example 2: react native section list sort by alphabet

Helpful resources for contact list using react native <SectionList/>
  
Blog: https://medium.com/swlh/simple-contacts-list-in-react-native-b5ff26ed3f55
Repo: https://github.com/rajatsharma2393/react-lists