Skip to content

Commit d665aea

Browse files
author
Tina C Lin (RD-TW)
committed
Use lodash.get to get object's value.
1 parent c30e3a3 commit d665aea

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@trendmicro/react-paginations": "^0.5.10",
5151
"trendmicro-ui": "^0.4.0",
5252
"classnames": "^2.2.5",
53+
"lodash.get": "^4.4.2",
5354
"prop-types": "^15.5.8"
5455
},
5556
"devDependencies": {

src/TableCell.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
3+
import get from 'lodash.get';
34
import styles from './index.styl';
45

56
class TableCell extends PureComponent {
@@ -17,7 +18,7 @@ class TableCell extends PureComponent {
1718
const { column, record } = this.props;
1819
const cName = column.dataIndex;
1920
const render = column.render;
20-
let text = record[cName];
21+
let text = get(record, cName);
2122
return (
2223
<div className={styles.td}>
2324
<div className={styles.tdContent}>

0 commit comments

Comments
 (0)