Javascript 在react中创建动态框时出错
当我通过高度为10,宽度为20时,它创建了一条水平线。我以为这是一盒特快专递。我应该做什么改变Javascript 在react中创建动态框时出错,javascript,reactjs,Javascript,Reactjs,当我通过高度为10,宽度为20时,它创建了一条水平线。我以为这是一盒特快专递。我应该做什么改变 import React, { Component } from "react"; class Box extends Component { render() { return ( <div> <div style={{ height: `${this.props.height}em`,
import React, { Component } from "react";
class Box extends Component {
render() {
return (
<div>
<div
style={{
height: `${this.props.height}em`,
widht: `${this.props.width}em`,
backgroundColor: this.props.color,
}}
/>
<button>X</button>
</div>
);
}
}
export default Box;
错误是什么?您有一个拼写错误:${this.props.width}em,这应该是width。谢谢。我没有注意到。现在可以工作了。有什么错误吗?您有一个输入错误:${this.props.width}em,这应该是width。谢谢。我没有注意到。现在开始工作了。