控制台报错
index.js:1 Warning: A string ref, "slider", has been found within a strict mode tree. String refs are a source of potential bugs and should be avoided. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref
解决这是因为React的严格模式导致的.
React.StrictMode标签去掉即可,这是React的严格模式导致的。
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'antd-mobile/dist/antd-mobile.css';
import './assets/fonts/iconfont.css'
import './index.css';
ReactDOM.render(
<App />,
document.getElementById('root')
);
|