I have written the following code based on the assumption that that your RefinementFilterComponent is a stateless functional component.
Here is a link to dev docs related to lists and mapping. https://facebook.github.io/react/docs/lists-and-keys.html
const sortActors = props.title.sort((a, b) => {
const [aFirst, aLast] = a.split(' ');
const [bFirst, bLast] = b.split(' ');
return aLast > bLast ? 1 : -1;
})
const renderActors = sortActors
.map(actor =>
<li key={actor.toString()}>
{actor}
</li>
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.