ali-react-table icon indicating copy to clipboard operation
ali-react-table copied to clipboard

fix: react18 createRoot渲染模式,严格模式下,渲染错误问题

Open sunxd-lab opened this issue 2 years ago • 1 comments

在react18版本,使用BaseTable, 用createRoot方式渲染,App被严格模式包裹时,会导致组件无法正确渲染

import ReactDOM from "react-dom/client";
const root = ReactDOM.createRoot(
  document.getElementById("root") as HTMLElement
);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

由于react18在严格模式下,对于类组件会先调用一次 componentWillUnmount, 导致rootSubscription被取消订阅 image

sunxd-lab avatar Jan 04 '24 02:01 sunxd-lab

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 04 '24 02:01 CLAassistant