title: How to do conditional rendering using switch in react native?
body: <p>Hello I'm trying to do switch statement in my project.I've an object image as follows</p>
  
  <pre><code>export const images = [
    {
      image: BASE.URL + 'Images/Plumber.png',
  
    },
    {
      image: BASE.URL + 'Images/electrician.png',
  
  
    },
   {
      image: BASE.URL + 'Images/ac.png',
  
    }
  ]
  </code></pre>
  
  <p>I'm fetching the list of workers from server and render it within a <code>Card</code>.So the server response only contains the name of workers.I'm trying to give images along with them.So I've written a switch statement but image is not coming along with the text.Following is my code.</p>
  
  <pre><code>    import { images } from './data';
      renderImage() {
          const { workType } = this.state;
          switch (workType) {
            case 'Plumber':
              return (
                &lt;Image style={{ height: 100, width: 100 }} source={{ uri: images[0].image }} /&gt;
              );
            case 'Electrician':
              return (
                &lt;Image style={{ height: 100, width: 100 }} source={{ uri: images[1].image }} /&gt;
              );
       case 'AC'
              return (
                &lt;Image style={{ height: 100, width: 100 }} source={{ uri: images[2].image }} /&gt;
              );
          }
        }
     render(){
      const { workers,workType } = this.state;
      return(
      {workers.map((a, index) =&gt; (
                      &lt;TouchableOpacity onPress={() =&gt; this.popUpDialog(a.id, a.work_type)}&gt;
                        &lt;Card&gt;
                          {this.renderImage()}
                          &lt;Text&gt;{a.work_type}&lt;/Text&gt;
                        &lt;/Card&gt;
                      &lt;/TouchableOpacity&gt;
                ))}
      )
      }
  </code></pre>
  
  <p>What wrong I'm doing please help me to find a solution.Thank you!</p>