Flow error: (This type is incompatible with the expected param type of Element)
ReactDOM.render(, document.querySelector(APP_CONTAINER_SELECTOR));
But if I add the following code.
const rootEl = document.querySelector(APP_CONTAINER_SELECTOR);
if (!(rootEl instanceof Element)) {
throw new Error('invalid type');
}
ReactDOM.render(, rootEl);
Type of issue: Bug
Chapter: 04
If it's a bug: Yes
Flow error: (This type is incompatible with the expected param type of Element) ReactDOM.render( , document.querySelector(APP_CONTAINER_SELECTOR));
But if I add the following code. const rootEl = document.querySelector(APP_CONTAINER_SELECTOR); if (!(rootEl instanceof Element)) { throw new Error('invalid type'); } ReactDOM.render( , rootEl);
the Flow errors are gone.