Uncaught TypeError: Cannot read properties of undefined (reading '0')
See original GitHub issueHi,
I downloaded my selection.json and inserted it correctly in path, there is a “pencil” named icon in it.
So I used <Icon icon="pencil" size={20} color="orange" />
and got this:
index.tsx:82 Uncaught TypeError: Cannot read properties of undefined (reading '0')
at index.tsx:82:1
at Array.map (<anonymous>)
at IcoMoon (index.tsx:81:1)
at renderWithHooks (react-dom.development.js:14985:1)
at mountIndeterminateComponent (react-dom.development.js:17811:1)
at beginWork (react-dom.development.js:19049:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
at invokeGuardedCallback (react-dom.development.js:4056:1)
at beginWork$1 (react-dom.development.js:23964:1)
at performUnitOfWork (react-dom.development.js:22776:1)
at workLoopSync (react-dom.development.js:22707:1)
at renderRootSync (react-dom.development.js:22670:1)
at performSyncWorkOnRoot (react-dom.development.js:22293:1)
at react-dom.development.js:11327:1
at unstable_runWithPriority (scheduler.development.js:468:1)
at runWithPriority$1 (react-dom.development.js:11276:1)
at flushSyncCallbackQueueImpl (react-dom.development.js:11322:1)
at workLoop (scheduler.development.js:417:1)
at flushWork (scheduler.development.js:390:1)
the above error occurred in the <IcoMoon> component:
at IcoMoon (http://localhost:3000/static/js/2.chunk.js:16958:20)
at Icon
at form
at ReactFinalForm (http://localhost:3000/static/js/3.chunk.js:1727:20)
at div
at http://localhost:3000/static/js/vendors~main.chunk.js:324789:73
at Paper (http://localhost:3000/static/js/vendors~main.chunk.js:364808:86)
at http://localhost:3000/static/js/vendors~main.chunk.js:324789:73
at Card (http://localhost:3000/static/js/vendors~main.chunk.js:345325:86)
at div
at http://localhost:3000/static/js/vendors~main.chunk.js:324789:73
at Grid (http://localhost:3000/static/js/vendors~main.chunk.js:353724:91)
at div
at http://localhost:3000/static/js/vendors~main.chunk.js:324789:73
at Grid (http://localhost:3000/static/js/vendors~main.chunk.js:353724:91)
at div
at http://localhost:3000/static/js/vendors~main.chunk.js:324789:73
at Container (http://localhost:3000/static/js/vendors~main.chunk.js:348606:86)
at Datatable (http://localhost:3000/static/js/50.chunk.js:423:90)
at Admin (http://localhost:3000/static/js/50.chunk.js:1787:52)
at Suspense
at B (http://localhost:3000/static/js/vendors~main.chunk.js:556649:10)
at BaseLayout (http://localhost:3000/static/js/main.chunk.js:6268:5)
at LocalizationProvider (http://localhost:3000/static/js/vendors~main.chunk.js:337110:5)
at InnerThemeProvider (http://localhost:3000/static/js/vendors~main.chunk.js:397702:74)
at ThemeProvider (http://localhost:3000/static/js/vendors~main.chunk.js:392324:5)
at ThemeProvider (http://localhost:3000/static/js/vendors~main.chunk.js:397722:5)
at StylesProvider (http://localhost:3000/static/js/vendors~main.chunk.js:394935:5)
at ThemeProviderWrapper (http://localhost:3000/static/js/main.chunk.js:11166:92)
at App (http://localhost:3000/static/js/main.chunk.js:124:85)
at x (http://localhost:3000/static/js/vendors~main.chunk.js:556667:13)
at w (http://localhost:3000/static/js/vendors~main.chunk.js:555238:13)
at SidebarProvider (http://localhost:3000/static/js/main.chunk.js:1098:5)
at r (http://localhost:3000/static/js/vendors~main.chunk.js:552458:19)
“react”: “17.0.2”, “react-scripts”: “4.0.3”
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeError: Cannot read Property '0' of Undefined in JS
The "Cannot read property '0' of undefined" error occurs when trying to access the 0th index in a variable that stores an undefined...
Read more >How To Fix Cannot read Property '0' of Undefined in JS
The Solution · Ensure you are using the correct variable · Perform a simple check on your variable before using it to make...
Read more >How to Prevent the Error: Cannot Read Property '0' of Undefined
If a property of an object is an array, it's possible to accidentally misspell the key or try to access the array through...
Read more >reactjs - Cannot read properties of undefined (reading '0')
I think the error has to do with data[0] being undefined ... · In your fetcher function you're returning the data as {...
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined ... JavaScript TypeError is thrown when an operand or argument passed to a function is...
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
Thanks @Simoneth. You can use
react-icomoon@2.5.1
version. Problem solved.Here we go:
In the meantime I tried to load another set of icons, without imported custom icons like the above, and everything works fine.