why can't my first post request success on react native custom hooks with axios?

Solution 1:

Well, wrote in this way, basically, when this this code is excecuted

if(res) {  
  // Something to do with result
}

the variable res has null as value, initially.

You should check for changes in res with useEffect instead, like:

useEffect(()=> {
  if(res) {
    // Something to do with result
  }
}, [res])