React引入antd(Ant-design3)出现错误情况记录

Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)

在stackoverflow出现类似问题,解决方案如下:
https://stackoverflow.com/questions/41123631/how-to-get-the-version-from-the-package-json-in-typescript

https://stackoverflow.com/questions/70298948/how-to-securely-import-version-from-package-json-while-respecting-error-should/70333147#70333147

本人采取方案为降低react的版本,退回至React16

React版本降低命令如下:
npm install react@16.12.0 react-dom@16.12.0 --save

错误:降低React版本后出现Module not found: Error: Can't resolve 'react-dom/client' in '路径'和页面空白错误

版本React16导入库错误,
修改如下:在index.js文件进行修改

import React from 'react';

//修改前
// import ReactDOM from 'react-dom/client';
//修改后
import ReactDOM from 'react-dom';

import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';


//修改前语法
// const root = ReactDOM.createRoot(document.getElementById('root'));
// root.render(
//   <React.StrictMode>
//     <App />
//   </React.StrictMode>
// );

//修改后语法
ReactDOM.render(
    <React.StrictMode>
        <App />
    </React.StrictMode>,
    document.getElementById('root')
);


// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();