Skip to content

Commit 6b406e0

Browse files
committed
fixed issue with passing wrong children to method
1 parent c9a7895 commit 6b406e0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default class Markdown extends Component {
5252
* @return {boolean}
5353
*/
5454
shouldComponentUpdate(nextProps, nextState) {
55-
const copy = this.getCopyFromProps(nextProps);
55+
const copy = this.getCopyFromChildren(nextProps.children);
5656

5757
if (copy !== this.copy) {
5858
this.copy = copy;
@@ -77,18 +77,18 @@ export default class Markdown extends Component {
7777
}
7878
}
7979

80-
getCopyFromProps(props = this.props.children) {
81-
return props.children instanceof Array
82-
? props.children.join('')
83-
: props.children;
80+
getCopyFromChildren(children = this.props.children) {
81+
return children instanceof Array
82+
? children.join('')
83+
: children;
8484
}
8585

8686
/**
8787
*
8888
* @return {View}
8989
*/
9090
render() {
91-
const copy = (this.copy = this.getCopyFromProps());
91+
const copy = (this.copy = this.getCopyFromChildren());
9292
const { renderer } = this.props;
9393

9494
return parser(copy, renderer, this.md);

0 commit comments

Comments
 (0)