title: How can I set current Project on MongoDB Realm Web APP using React.js
body: <p>I am following the <a href="https://docs.mongodb.com/realm/tutorial/web-graphql/" rel="nofollow noreferrer">Task Tracker (Web) with Reaml, Apollo Client and React.js Tutorial</a>  and I am getting an on getting the user project. Below is my code</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export default function TaskApp() {
    const app = useRealmApp();
    console.log(app.currentUser.customData)
    const [currentProject, setCurrentProject] = React.useState(
      // set the current project as  "My Project"
      app.currentUser.customData.memberOf[0]
    );
    const [isEditingPermissions, setIsEditingPermissions] = React.useState(false);
    return (
      &lt;Container&gt;
        &lt;Sidebar
          css={gridAreaSidebar}
          currentProject={currentProject}
          setCurrentProject={setCurrentProject}
          setIsEditingPermissions={setIsEditingPermissions}
        &gt;&lt;/Sidebar&gt;
        &lt;ProjectScreen
          css={gridAreaMain}
          currentProject={currentProject}
          isEditingPermissions={isEditingPermissions}
          setIsEditingPermissions={setIsEditingPermissions}
        /&gt;
      &lt;/Container&gt;
    );
  }</code></pre>
  </div>
  </div>
  </p>
  <p>and below is the error am getting and I cannot understand why I am getting the error</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>TypeError: Cannot read properties of undefined (reading '0')
  TaskApp
  E:/Web Dev/Realm/realm-tutorial-web/src/TaskApp.js:13
    10 | console.log(app.currentUser.customData)
    11 | const [currentProject, setCurrentProject] = React.useState(
    12 |   // set the current project as  "My Project"
  &gt; 13 |   app.currentUser.customData.memberOf[0]
       | ^  14 | );
    15 | const [isEditingPermissions, setIsEditingPermissions] = React.useState(false);
    16 | return (</code></pre>
  </div>
  </div>
  </p>
  <p>am still new to realm so please help where possible.</p>