I am looking to sort alpha numeric with lodash and written the below function, I am using common function for both type of sorts (sorting alphabets and sorting alphanumeric )
import sortBy from 'lodash/sortBy';
export const SecondaryQueryExecutor = ({ query, updateState, isJsonData }) => {
const { loading, data, errorRedirect: error } = useSectionQuery(query, null, isJsonData);
updateState(draft => {
draft.loading = { ...draft.loading, [query.resultFieldName]: loading };
});
updateState(draft => {
draft.queryResults = {
...draft.queryResults,
[query.resultFieldName]: sortBy(data, o => o.name) // this is where I applied sorting
};
});
return error || null;
};
but this sort looks like it is not working and it is sorting like this as below
Could any one please let me know how can I achieve alphanumeric sorting with those above mentioned values and need to tackle the alphabet sorting as well.
Many thanks in advance !!!