在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ react升級v16版本后,使用antd的很多組件會報錯?

react升級v16版本后,使用antd的很多組件會報錯?

把react升到V16版本后遇到很多坑
譬如在引入antd的組件如Button沒問題,但引入DatePicker等組件就會報錯;
Uncaught TypeError: Cannot read property 'object' of undefined;
具體錯誤位置截圖如下
圖片描述

但我覺得跟引入prop-types沒有關系,也沒用到props來傳遞值
下面是我的一段代碼,

import React from 'react';
import { DatePicker, Button } from 'antd';
//import PropTypes from 'prop-types';
//const { MonthPicker, RangePicker, WeekPicker } = DatePicker;

export default class Home extends React.Component {
    
    render() {
        return (
            <div>
                <Button type="primary">Primary</Button> 
                <br />
                {/*<DatePicker />*/} 
            </div>
        )
    }
}

能給點建議就萬分感謝了

回答
編輯回答
離人歸

antd 在 3.0 之后兼容 react@16.

2.x 的版本請使用 react@15

2017年10月17日 17:33
編輯回答
鐧簞噯

刪除掉整個node_modules再重新install

2017年12月16日 03:55