component: JSResource()

in issue-tracker/src/routes.js [36:59]


        component: JSResource('HomeRoot', () => import('./HomeRoot')),
        /**
         * A function to prepare the data for the `component` in parallel with loading
         * that component code. The actual data to fetch is defined by the component
         * itself - here we just reference a description of the data - the generated
         * query.
         */
        prepare: params => {
          const IssuesQuery = require('./__generated__/HomeRootIssuesQuery.graphql');
          return {
            issuesQuery: loadQuery(
              RelayEnvironment,
              IssuesQuery,
              {
                owner: 'facebook',
                name: 'relay',
              },
              // The fetchPolicy allows us to specify whether to render from cached
              // data if possible (store-or-network) or only fetch from network
              // (network-only).
              { fetchPolicy: 'store-or-network' },
            ),
          };
        },