Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort by string react

const myData = this.state.contacts
 .sort((a, b) => a.name.localeCompare(b.name))
 .map((item, i) => <List key={i} data={item} />);
Never look this up again
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #string #react
ADD COMMENT
Topic
Name
4+4 =