【问题标题】:Getting a 'Warning: `NaN` is an invalid value for the `background` css style property.' error收到“警告:‘NaN’ 是‘background’ CSS 样式属性的无效值。”错误
【发布时间】:2019-05-01 16:35:20
【问题描述】:

react-move/Animate 错误: "警告:NaNbackground css 样式属性的无效值。"

原来的代码是这样的:

           enter={{
                background: [stripe.background],
            }}

解决方案:

我将背景属性的值更改为字符串文字并解决了问题。

           enter={{
                 background: `${stripe.background}`,
            }}

【问题讨论】:

  • 您遇到了什么问题?
  • 它没有将变量识别为值,因为它在括号中,需要更改为放入大括号中的字符串文字。
  • 现在修好了?
  • @MaazSyedAdeeb 是的
  • 干得好@ReidMcCulloch

标签: reactjs react-animations


【解决方案1】:

但它没有制作动画。在这种情况下,你可以写

background: stripe.background

在此链接中查看 React-Move animation background color change

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-01-24
    • 2015-06-26
    • 2013-08-18
    • 2016-02-10
    • 2014-10-03
    • 1970-01-01
    • 2023-03-31
    • 2014-11-11
    相关资源
    最近更新 更多