title: how to declare a variable inside a flatList renderItem?
body: <p>I'm trying to fetch the date and format it using moment , the solution i found is to store the date in a variable , and i've been having a problem with that followed this  <a href="https://stackoverflow.com/questions/47120286/unexpected-token-when-trying-to-declare-a-variable-inside-flatlist-in-react-nati">awnser</a> since i hade the same problem . although i managed to get rid of the unexpected token error but i got my self in another one . MY FLAT LIST IS NOT SHOWING ANYMORE.
   here is my code :</p>
  
  <pre><code>    import React, { Component } from "react";
  import {View,StyleSheet,FlatList,ListView} from "react-native";
  import {Container, Header, Left, Body, Right, Title, Subtitle,Icon ,Content, Footer, FooterTab, Button, Text,Badge , List , ListItem} from 'native-base'
  import Icon0 from 'react-native-vector-icons/MaterialCommunityIcons'
  import Icon1 from 'react-native-vector-icons/FontAwesome'
  import CountDown from 'react-native-countdown-component';
  import moment from 'moment';
  
  
  class Consulter extends Component{
  
  
    state ={
      data:[]
    }
    fetchData= async()=&gt;{
        const response = await fetch('http://192.168.1.4:3000/rendezvous/1');
        const rendezvous =await response.json();
        this.setState({data:rendezvous});
    }
  
    componentDidMount() {
        this.fetchData();
    }
  
  
  
  
    render() {
      const today = this.state.currentDate;
      const day = moment(today).format("dddd");
      const date = moment(today).format("MMMM D, YYYY");
        return (
          &lt;Container&gt;
                 &lt;Content &gt;
                   &lt;View style ={{ flex:1}}&gt;
                     &lt;FlatList
                       data={this.state.data}
                       keyExtractor={(item,index) =&gt; index.toString()}
                       renderItem={({item}) =&gt;
                       {let dates=item.date;
  
                        &lt;View style={{backgroundColor:'#e6e6e6',padding:10,margin:10}}&gt;
                          &lt;ListItem icon&gt;
                            &lt;Left&gt;
                              &lt;Button style={{ backgroundColor: "white" }}&gt;
                                &lt;Icon0 active name="doctor" /&gt;
                              &lt;/Button&gt;
                            &lt;/Left&gt;
                            &lt;Body&gt;
                              &lt;Text&gt;Nom du Docteur : Dr. {item.nom}&lt;/Text&gt;
                            &lt;/Body&gt;
                          &lt;/ListItem&gt;
                          &lt;ListItem icon&gt;
                            &lt;Left&gt;
                              &lt;Button style={{ backgroundColor: "white" }}&gt;
                                &lt;Icon1 active name="calendar" /&gt;
                              &lt;/Button&gt;
                            &lt;/Left&gt;
                            &lt;Body&gt;
                              &lt;Text&gt;Date du rendez-vous :&lt;/Text&gt;
  
                              &lt;Text&gt; dates &lt;/Text&gt;
                            &lt;/Body&gt;
                          &lt;/ListItem&gt;
                          &lt;ListItem icon&gt;
                            &lt;Left&gt;
                              &lt;Button style={{ backgroundColor: "white" }}&gt;
                                &lt;Icon1 active name="calendar"/&gt;
                              &lt;/Button&gt;
                            &lt;/Left&gt;
                            &lt;Body&gt;
                              &lt;CountDown
                                until= {item.date}
                                timetoShow={('H', 'M', 'S')}
                                onFinish={() =&gt; alert('finished')}
                                onPress={() =&gt; alert('hello')}
                                size={10}
                              /&gt;
                          &lt;/Body&gt;
                        &lt;/ListItem&gt;
                      &lt;/View&gt;
                    }}
                  /&gt;
                &lt;/View&gt;
              &lt;/Content&gt;
            &lt;/Container&gt;
          );
        }
  }
      export default Consulter;
      const styles =StyleSheet.create({
        container : {
          flex: 1,
        }
      })
  </code></pre>
  
  <p>Ps : there is no compilation errors.</p>