Tip: Annoyed by how libraries like Axios place the response under .data


Tip: Annoyed by how libraries like Axios place the response under .data?

Destructuring with renaming to the rescue:

const { data: user } = await axios.get("/user");

Now the const "user" holds the user data. 😎

#javascript

View original on X