TypeError: Cannot set property 'getFragmentDoc' of undefined
See original GitHub issueI’m trying out Apollo Client 3 with create-react-app. I’m getting the error below. Not sure what am I doing wrong.
Index.js
App.js
Actual outcome:
Versions
System:
OS: macOS 10.15.6
Binaries:
Node: 14.5.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Browsers:
Chrome: 81.0.4044.138
Safari: 13.1.2
npmPackages:
@apollo/client: ^3.0.2 => 3.0.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Cannot set property 'firstname' of undefined at new ...
You defined a type, but its value is still undefined import { Component, OnInit } from '@angular/core'; export class User { constructor( ...
Read more >class InMemoryCache - Apollo GraphQL Docs
Writes data to the cache in the shape of a provided GraphQL query. Returns a Reference to the written object or undefined if...
Read more >Uncaught TypeError: Cannot set property
In JavaScript if a variable has been declared, but has not been assigned a value, is automatically assigned the value undefined.
Read more >How to solve the 'cannot set property of undefined' issue on ...
Therefore, if you try to access the value of such variable, it will throw Uncaught TypeError cannot set property '0' of undefined/null ....
Read more >Renovate Bot Package Diff
InvariantError("Cannot automatically merge arrays") : new tsInvariant. ... }\n catch (e) {\n if (e instanceof TypeError)\n return null;\n throw e;\n }\n }\n ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The inmemorycache should be instantiated with “new” keyword.
Confirming @theneshofficial’s answer (use
new InMemoryCache()
).In strict mode, if you call a constructor function without
new
,this
will be undefined. If you’re using nativeclass
syntax rather than transpiling, constructor functions will throw an exception if you call them without usingnew
, which helps prevent this problem, but most people are still transpilingclass
tofunction
to support older browsers.