Axios sort data by ID or others,

Diko_Mahendra
Jun 17, 2021

you can sort data with query params in axios

example:

const url = http://localhost:5000/v1/api/

axios.get( url+’users?_sort=[custom_sort]&_order=[custom_order]’)

explanation:

custom_sort: you can sort data by [ID, or others what you want] for implementation you can remove symbol [].

EXAMPLE: http://localhost:5000/v1/api/_sort=id

custom_order : you have 2 options that is ASC & DESC

ASC or ascending is sort data from first to the last

DESC or descending is sort data from the last to first

thank you for,

happy reading ^_^

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Diko_Mahendra
Diko_Mahendra

Written by Diko_Mahendra

Frontend Engineer at Telkom Indonesia

Responses (1)

Write a response