title: How To Refresh Data Every Time Opening The Page In React Native?
body: <p><strong>Current Code</strong></p>
  
  <p><em>App.js</em></p>
  
  <pre class="lang-js prettyprint-override"><code>const Mypage = {
    screen: MypageScreen,
    navigationOptions: () =&gt; ({
      headerShown: false,
    }),
  };
  
  const MypageStack = createStackNavigator(
    { Mypage },
    {
      initialRouteName: 'Mypage',
      navigationOptions: {
        title: 'Mypage',
      },
    },
  );
  
  const postLoginNavigator = createBottomTabNavigator({
    Mypage: MypageStack,
  });
  
  const AppNavigator = createStackNavigator({
    Loading,
    ...,
    PostLogin: postLoginNavigator,
  }, {
    mode: 'modal',
    headerMode: 'none',
    initialRouteName: 'Loading',
  });
  
  const AppContainer = createAppContainer(AppNavigator);
  
  export default class App extends React.Component {
    render() {
      return (
        &lt;AppContainer /&gt;
      );
    }
  }
  </code></pre>
  
  <p><em>Mypage.js</em></p>
  
  <pre class="lang-js prettyprint-override"><code>export default class Mypage extends Component {
    constructor(props) {
      super(props);
      this.state = {
        items: '',
      };
    }
  
    async componentDidMount() {
      // getting how many items this user have
      const items = await db.getAllItems()
      // items is an array
      this.setState({
        items: items.length,
       });
    }
  
    render() {
      return (
        &lt;View&gt;
          &lt;Text&gt;Items&lt;/Text&gt;
        &lt;/View&gt;
        &lt;View&gt;
          &lt;Text&gt;
            { this.state.items }
          &lt;/Text&gt;
        &lt;/View&gt;
      );
    }
  }
  </code></pre>
  
  <p><strong>What I'm Trying To Do</strong></p>
  
  <p>I want the datas to be refreshed When every time I open mypage tab.</p>
  
  <p>The number of items in mypage.js is changing, so I want updated number of items.</p>
  
  <p>Or when only number of items changes, I want updated number.</p>
  
  <p>I would appreciate it if you could give me any advices.</p>