引导反应

时间:2017-10-24 09:21:05

标签: reactjs react-bootstrap

我正在使用react-bootstrap-select。但是当我运行我的项目时,我收到一个错误:

  

TypeError:React .__ spread不是函数

 TypeError: React.__spread is not a function
render
d:/PROJECTS/REACT_APP/bsapp/node_modules/react-bootstrap-select/dist/Select.js:58
  55 |   },
  56 |   render: function () {
  57 |     return (
> 58 |       React.createElement(Input, React.__spread({},  this.props, {type: "select"}))
  59 |     );
  60 |   }
  61 | });

如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

React.__spread has been removed in React 15.x

你的React版本是什么?您正在使用的react-bootstrap-select版本可能与您的React版本不兼容。

答案 1 :(得分:0)

React .__ spread已在React 15.0中弃用:See this issue

在该问题中,您可以使用Lodash阅读Kuon所做的解决方法:

import {assign} from 'lodash';
(React as any).__spread = assign;

我已经尝试过并且效果很好! 希望它有所帮助!