EatTheBlocks Forum

Nft101 connect failing


I am following the NFT101 series of training videos and have created React App. When I created the Helper.js file and put in the code as shown in training video, I see following message appear for the line of code.

Line of Code:
const accounts = await **window.ethereum**.request({ method: 'eth_requestAccounts' })

Property ‘ethereum’ does not exist on type ‘Window & typeof globalThis’.ts(2339)

There are no errors but as expected when I run the app, my NFT images does not load and the browser console shows me below message:

       TypeError: Cannot read properties of undefined (reading 'request')
    **at connect (helpers.js:4)**
    at App.js:32
    at App.js:36
    at invokePassiveEffectCreate (react-dom.development.js:23487)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at flushPassiveEffectsImpl (react-dom.development.js:23574)
    at unstable_runWithPriority (scheduler.development.js:468)
    at runWithPriority$1 (react-dom.development.js:11276)
    at flushPassiveEffects (react-dom.development.js:23447)
    at react-dom.development.js:23324
    at workLoop (scheduler.development.js:417)
    at flushWork (scheduler.development.js:390)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:157)

In addition to the above, I see this below warning as well in the browser console.
React Hook useEffect has a missing dependency: ‘getNfts’. Either include it or remove the dependency array react-hooks/exhaustive-deps
printWarnings @ webpackHotDevClient.js:138
handleWarnings @ webpackHotDevClient.js:143
push…/node_modules/react-dev-utils/webpackHotDevClient.js.connection.onmessage @ webpackHotDevClient.js:210

I have verified the Github code to compare with mine, and did not find any difference.
Please help to check and clarify to understand the issue here.



your information is very interesting and good question but i am not idea.