React-Style, Webpack, React - Uncaught Error: Invariant Violation: The `style` prop

后端 未结 2 1978
忘掉有多难
忘掉有多难 2021-01-11 19:49

I\'m getting the following error in my browser:

Uncaught Error: Invariant Violation: The style prop expects a mapping from style properti

相关标签:
2条回答
  • 2021-01-11 20:06

    I used the style attribute in JSX file like this

    style={{textTransform: 'uppercase'}}
    

    and it worked for me

    0 讨论(0)
  • 2021-01-11 20:13

    React Style requires you to use the styles prop instead of style.

    var HoverAction = React.createClass({
        render: function() {
            return (
                <div styles={HoverActionStyles.normal}>
                    <div ></div>
                    <div styles={HoverActionTitleStyle.normal} >{this.props.title}</div>
                </div>
            );
        }
    });
    
    0 讨论(0)
提交回复
热议问题