[英]React - 'classProperties' isn't currently enabled
I added Truncate-react
to my project.我在我的项目中添加了
Truncate-react
。 After that, React tells me I need to install @babel/plugin-proposal-class-properties
, which I did in package.json file in this way:之后,React 告诉我需要安装
@babel/plugin-proposal-class-properties
,我在package.json文件中以这种方式安装:
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
}
Of course, the proposal-class-properties
itself I installed with the label --save-dev当然,
proposal-class-properties
本身是我用标签--save-dev安装的
but after all this, I still get an error that looks like this但毕竟这一切,我仍然收到一个看起来像这样的错误
based on the github link you sent you have to do 2 things to make it work根据您发送的 github 链接,您必须做两件事才能使其正常工作
import TextTruncate from 'react-text-truncate/src/TextTruncate'
to import TextTruncate from 'react-text-truncate'
in VideoCard component.import TextTruncate from 'react-text-truncate/src/TextTruncate'
import TextTruncate from 'react-text-truncate'
。 I assume react-text-truncate/src/TextTruncate this file is not the compiled version
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.