Aleksey
L.在评论中首当其冲,我想将此信息提高到答案级别,以便于视觉扫描。
Flow让您知道调用
document.getElementById("root");可以返回,null在这种情况下,应用程序将完全崩溃。因此,请注意以下几点:
const root = document.getElementById('root')if (root !== null) { ReactDOM.render(<App /> , root)}的确,由于您很可能将控制要渲染到的HTML,所以这会让人感到烦恼。



