Q: Why is axios returning "Promise { : "pending" }" var user = axios.post(url, { data }).then(res => {
    return res.data
})

I think the following code should return JSON data but instead it is returning "Promise { : "pending" }". Any help please

A: I'm not going to reinvent the weel. If you want to learn about promises, here is the MDN web doc : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
If you want a solution to your problem you can either : 
axios.post(url, { data }).then(res => {
    var user = res.data
})

Or in an async function you can use the await operator: 
var user = (await axios.post(url, { data })).data

