title: Is this a bad way to use ternary if else with promises in React
body: <p>I am using ternary if else for calling different APIs(API calls are stored in another file).</p>
  
  <pre><code>(this.props.item === "burger" ? burgerObj.GetBurger (this.props.burger_id) : pizzaObj.GetPizza (this.props.pizza_id)) // burgerObj and pizzaObj are objects of their respective classes
          .then((response) =&gt; {
              if(response.status === 400) {
                console.log ("Bad Request")
              }
              else {
                  response.json()
                  .then((findresponse) =&gt; {
                      this.prepareFood(findresponse) // Some function call
                  })
              }
          })
          .catch ((e) =&gt; {
              console.log (e)
          })
      }
  
  
  // API calls in different classes. Same is for GetPizza
  GetBurger(burger_id) {
  return fetch(url + 'burgerId' + burger_id , {
    headers: {
        'Authorization': 'Bearer ' + authorization,
        'Content-Type': 'application/json',
    }
  })
  </code></pre>
  
  <p>}</p>
  
  <p>Is this a wrong way of handling such calls. Because when I'm using this API calling is working fine but the code never reaches promise (.then((response) => {  - line no. 2). If I check Network I can see the response returned from API. Sorry if I am wrong somewhere I'm still new to React. Please help me.</p>