title: How to render a string using nested ternary operator using react?
body: <p>i want to display a particular string based on condition using ternary operator using react.</p>
  <p>below is my code,</p>
  <pre><code>const ChildComponent = (data) =&gt; {
      const name = data.name //array
      const type = data.type //object
  
      return (
          &lt;div&gt;{type.name} {type.id} &lt;/div&gt; //here condition to be added
      );
  }
  </code></pre>
  <p>for the above code in return block type.name and type.id are displayed.</p>
  <p>now i want to display name if there is type and type.name. id should be shown if type and type.id and &quot;none&quot; to be displayed if no type and type.name or type.id</p>
  <p>could someone help me get this fixed. thanks.</p>