hot-loader / react-dom

🔥 version of React-DOM
110 stars 11 forks source link

Uncaught TypeError: Cannot read property '__reactstandin__key' of undefined #16

Closed alexandru-tomescu closed 5 years ago

alexandru-tomescu commented 5 years ago

HI. I'm trying to use Link component from react-router-dom in a library package created with lerna (Lerna manages app and library packages), and when i'm inserting it in render method, i'm getting this error from react-hot-loader.development.js

react-hot-loader.development.js:1243 Uncaught TypeError: Cannot read property '__reactstandin__key' of undefined
    at isProxyType (react-hot-loader.development.js:1243)
    at resolveProxy (react-hot-loader.development.js:1735)
    at resolveType (react-hot-loader.development.js:1756)
    at Object.React$$1.createElement (react-hot-loader.development.js:2847)
    at e.default (AppsList.js:655)
    at renderWithHooks (react-dom.development.js:13451)
    at mountIndeterminateComponent (react-dom.development.js:15607)
    at beginWork (react-dom.development.js:16240)
    at performUnitOfWork (react-dom.development.js:20281)
    at workLoop (react-dom.development.js:20322)
    at HTMLUnknownElement.callCallback (react-dom.development.js:149)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:198)
    at invokeGuardedCallback (react-dom.development.js:252)
    at replayUnitOfWork (react-dom.development.js:19505)
    at renderRoot (react-dom.development.js:20435)
    at performWorkOnRoot (react-dom.development.js:21359)
    at performWork (react-dom.development.js:21269)
    at performSyncWork (react-dom.development.js:21243)
    at interactiveUpdates$1 (react-dom.development.js:21528)
    at interactiveUpdates (react-dom.development.js:2270)
    at dispatchInteractiveEvent (react-dom.development.js:5087)
theKashey commented 5 years ago

Problem is not in RHL, you are trying to render a component, which was not resolved to any valid shape, undefined in this case.

Anyway - RHL should not fail.

alexandru-tomescu commented 5 years ago

@theKashey this error and a few others was related to the library package, was using different instances of react, react-router (and so on) from the app, so i got rid of it with the webpack externals. Not clear if the instances issue was the reason of the error, but maybe this solution can help others too. I think for now this can be closed.

theKashey commented 5 years ago

RHL could patch only one version of React, and you are expected, especially now, to have only one version of React. See https://github.com/facebook/react/issues/13991#issuecomment-463486871 for details and different ways to solve the problem.

pizzarob commented 4 years ago

Hm. I get this error when trying to use a component that is actually undefined. I only have one version of react. It's not a helpful error.

theKashey commented 4 years ago

Please update react-hot-loader, it was fixed meanwhile