Skip to content

Commit f3ad63b

Browse files
committed
improve for destructuring assignment
1 parent 8fde9d6 commit f3ad63b

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/TableColumn.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,32 @@ class TableColumn extends Component {
6262

6363
render() {
6464
const {
65-
children
65+
children,
66+
columnTitle,
67+
className,
68+
dataAlign,
69+
hidden,
70+
cellEdit
6671
} = this.props;
72+
6773
const tdStyle = {
68-
textAlign: this.props.dataAlign,
69-
display: this.props.hidden ? 'none' : null
74+
textAlign: dataAlign,
75+
display: hidden ? 'none' : null
7076
};
7177

7278
const opts = {};
73-
if (this.props.cellEdit) {
74-
if (this.props.cellEdit.mode === Const.CELL_EDIT_CLICK) {
79+
80+
if (cellEdit) {
81+
if (cellEdit.mode === Const.CELL_EDIT_CLICK) {
7582
opts.onClick = this.handleCellEdit;
76-
} else if (this.props.cellEdit.mode === Const.CELL_EDIT_DBCLICK) {
83+
} else if (cellEdit.mode === Const.CELL_EDIT_DBCLICK) {
7784
opts.onDoubleClick = this.handleCellEdit;
7885
}
7986
}
8087
return (
8188
<td style={ tdStyle }
82-
title={ this.props.columnTitle }
83-
className={ this.props.className }
89+
title={ columnTitle }
90+
className={ className }
8491
{ ...opts }>
8592
{ typeof children === 'boolean' ? children.toString() : children }
8693
</td>

0 commit comments

Comments
 (0)