【发布时间】:2018-10-30 05:34:44
【问题描述】:
import React, { Component } from 'react';
class App extends Component {
render() {
const name = 'Red Header';
const styleRed = {backgroundColor : 'red'};
return (
<div style="{styleRed}">
{name}
</div>
);
}
}
export default App;
那是我的代码我正确地编写了样式对象,但反应仍然在争论。为什么会这样 它说:
'例如,使用 JSX 时 style={{marginRight:spacing + 'em'}}。'.
我的代码看起来像上面的代码,但 react 认为。
【问题讨论】:
标签: javascript reactjs