【发布时间】:2018-05-20 12:45:36
【问题描述】:
当我在本地主机中播放此代码时,它告诉我“未定义密钥”
import React from 'react';
import PropTypes from 'prop-types'
class LineTable extends React.Component{
supprimerLine = key => {
const newLines = {...this.state.newLines};
newLines[key] = null;
this.setState({newLines})
};
render(){
return(
<tr>
<td>{this.props.details.colone1}</td>
<td>{this.props.details.colone2}</td>
<td>{this.props.details.colone3}</td>
<td><button onClick={() => this.props.supprimerLine(key)}>
supprimer</button></td>
</tr>)};
static propTypes = {
supprimerLine: PropTypes.func.isRequired};}
export default LineTable
我认为是因为我没有导入密钥但我不知道如何导入它
【问题讨论】: