title: How to use es6 to let or const within if statement
body: <p>If I use <code>let</code> or <code>const</code> within a container controlling a page within a reactjs page it causes errors. If I use <code>var</code> it works fine. What am I missing understanding?</p>
  
  <pre><code>export default CareerHistoryContainer = createContainer(({match, isCandidate, isAdmin}) =&gt; {
    if (isCandidate) {
      var profileCandidateCollectionHandle = Meteor.subscribe('profileCandidate.private');
      var loading = !profileCandidateCollectionHandle.ready();
      var profileCandidateCollection = ProfileCandidate.findOne({userId: Meteor.userId()});
      var profileCandidateCollectionExist = !loading &amp;&amp; !!profileCandidateCollection;
    }
  
    if (isAdmin) {
      var adminProfileCandidatesubscribeSubscribe = Meteor.subscribe('admin.candidateProfile', (match.params.userId));
      var loading = !adminProfileCandidatesubscribeSubscribe.ready();
      var profileCandidateCollection = ProfileCandidate.findOne({userId: match.params.userId});
      var profileCandidateCollectionExist = !loading &amp;&amp; !!profileCandidateCollection;
    }
  
    return {
      loading,
      profileCandidateCollection,
      profileCandidateCollectionExist,
      profileCandidate: profileCandidateCollectionExist
        ? profileCandidateCollection
        : {}
    };
  }, CareerHistoryFormPage);
  </code></pre>