title: Adding Additional Conditions To IF ELSE
body: <p>I'm building my first Ionic React app and created a simple custom component that returns content based on two optional input values.</p>
  <p>When I had a simple if/else if/else conditional, the component rendered fine, but adding an extra 'else if' prevents it from compiling and I've not been able to establish why.</p>
  <p>Here's the working component:</p>
  <pre><code>import React from 'react';
  import './CardContainer.css';
  
  interface ContainerProps {
      position?: string;
      content?: string;
  }
  
  const CardContainer: React.FC&lt;ContainerProps&gt; = ({ position = &quot;right&quot;, content = &quot;n/a&quot;}) =&gt; {
      let cardOutput;
      if ( position.trim().toLowerCase() === &quot;right&quot; ) {
          cardOutput = &lt;&gt;&lt;div className=&quot;ion-float-right&quot;&gt;{content}&lt;/div&gt;&lt;div className=&quot;clear-right&quot;&gt;&lt;/div&gt;&lt;/&gt;;
      } else if ( position.trim().toLowerCase() === &quot;left&quot; ) {
          cardOutput = &lt;div className=&quot;ion-float-left&quot;&gt;{content}&lt;/div&gt;;
      } else {
          cardOutput = &lt;div className=&quot;ion-float-left&quot;&gt;{content}&lt;/div&gt;;
      }
      return (
          cardOutput
      )
  };
  
  
  export default CardContainer;
  </code></pre>
  <p>And here is the code that won't compile:</p>
  <pre><code>import React from 'react';
  import './CardContainer.css';
  
  interface ContainerProps {
      position?: string;
      content?: string;
  }
  
  const CardContainer: React.FC&lt;ContainerProps&gt; = ({ position = &quot;right&quot;, content = &quot;n/a&quot;}) =&gt; {
      let cardOutput;
      if ( position.trim().toLowerCase() === &quot;right&quot; ) {
          cardOutput = &lt;&gt;&lt;div className=&quot;ion-float-right&quot;&gt;{content}&lt;/div&gt;&lt;div className=&quot;clear-right&quot;&gt;&lt;/div&gt;&lt;/&gt;;
      } else if ( position.trim().toLowerCase() === &quot;left&quot; ) {
          cardOutput = &lt;div className=&quot;ion-float-left&quot;&gt;{content}&lt;/div&gt;;
      } else if ( position.trim().toLowerCase() === &quot;empty&quot; ) {
          cardOutput = &lt;div className=&quot;ion-padding-top&quot;&gt;{content}&lt;/div&gt;;
      }
      return (
          cardOutput
      )
  };
  
  export default CardContainer;
  </code></pre>
  <p>The only significant difference is that I've replaced the 'else' condition with an 'else if'. I've tried adding in an 'else' condition just to eliminate possible cause and this as expected doesn't fix the issue.</p>
  <p>When I try and run the app on my dev system I get this output:</p>
  <blockquote>
  <p>Type '({ position, content }: PropsWithChildren) =&gt;
  Element | undefined' is not assignable to type 'FC'.
  Type 'Element | undefined' is not assignable to type
  'ReactElement&lt;any, any&gt; | null'. Type 'undefined' is not assignable to
  type 'ReactElement&lt;any, any&gt; | null'.ts(2322)</p>
  </blockquote>
  <p>To my inexperienced eye this doesn't give me much indication of what the issue is beyond it relating to TypeScript.</p>