VikR VikR - 4 months ago 55
React JSX Question

GitHunt-React: Declaring `loading` Property?

I've duplicated the following code (and all the other relevant code I could find) from GitHunt-React to my app. This code is from CommentsPage.js:

const CommentsPageWithDataAndMutations = graphql(COMMENT_QUERY, {
options({ params }) {
return {
variables: { repoName: `${}/${params.repoName}` },
props({ data: { loading, currentUser, entry, updateQuery } }) {
return { loading, currentUser, entry, updateCommentsQuery: updateQuery };

For some reason in my app, loading is sometimes set to true, and sometimes is undefined.When I step through this code in GitHunt-React (not my app but the original sample code), the call stack shows all React internal functions, so I can't trace it back to the code in GitHunt-React that declares
. Also, doing a text search of the search code in GitHunt-React, doesn't seem to turn up anything setting the value of

In GitHunt-React, what part of the code is responsible for declaring
and setting its value?


The value of loading comes directly from Apollo Client, and is passed through react-apollo to the UI (GitHunt-React in this case).