Skip to content

Commit b6715c0

Browse files
committed
Do not mutate properties
Resolves #12
1 parent b8cfd35 commit b6715c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/Tree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Tree extends React.Component {
3939
}
4040

4141
onCheck(node) {
42-
const { checked } = this.props;
42+
const checked = [...this.props.checked];
4343
const isChecked = node.checked;
4444

4545
this.setCheckState(checked, node, isChecked);
@@ -49,7 +49,7 @@ class Tree extends React.Component {
4949

5050
onExpand(node) {
5151
const isExpanded = node.expanded;
52-
const expanded = this.props.expanded;
52+
const expanded = [...this.props.expanded];
5353
const nodeIndex = expanded.indexOf(node.value);
5454

5555
if (!isExpanded && nodeIndex > -1) {

0 commit comments

Comments
 (0)