-
Notifications
You must be signed in to change notification settings - Fork 792
Closed
Description
Description
When doing <A /> and A is undefined for some reason, instead of failing with the typical
Expected behavior
The typical React warning
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
should be logged.
Actual behavior
An error that would lead one to believe that it is react-hot-loader bugging out, rather than the actual (typically) userland mistake.
Uncaught TypeError: Cannot read property '__reactstandin__key' of undefined
at isProxyType (react-hot-loader.development.js:1229)
at resolveProxy (react-hot-loader.development.js:1770)
at resolveSimpleType (react-hot-loader.development.js:1786)
at Object.React$$1.createElement (react-hot-loader.development.js:2820)
at CMSNav (index.js:123)
Environment
React Hot Loader version: 4.12.11
-
node -v: v11.11.0 -
npm -v: 6.7.0 -
Operating system: macOS Mojave 10.14.5
-
Browser and version: Chrome 75
Reproducible Demo
import React from "react";
import { hot } from "react-hot-loader/root";
import ReactDOM from "react-dom";
// createElement
ReactDOM.render(
React.createElement(hot(() => React.createElement(undefined))),
document.body,
);
// JSX
const A = undefined;
const App = hot(() => <A />);
ReactDOM.render(<App />, document.body);
Just rendering <A/> anywhere in the component tree gets you there. Calling hot(undefined) also doesn't give a particularly useful error messages, but it's pretty easy to catch and probably a very rare mistake.
Metadata
Metadata
Assignees
Labels
No labels