In Reactjs, I need to turn the below try catch function into promise function:
  function one(){
      try{
       const response = await AA.sendMsg({XX})
       if(response){
           setState({response})
         }
       }catch(e){
        console.log(e)
        }
    }
My coding is like this:
const one = new Promise((resolve,reject))=> {
    AA.sendMsg({XX})
  .then(response => setState({response}) )
  .catch(e => {console.log(e)})
}
But it does not work. Anyone can tell me the right way to do it?
 
    