Browse Source

better performance

Daniel Zlotin 7 years ago
parent
commit
16a75a0f04
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/containers/ContainerWrapper.js

+ 6
- 1
src/containers/ContainerWrapper.js View File

6
     return class extends Component {
6
     return class extends Component {
7
       constructor(props) {
7
       constructor(props) {
8
         super(props);
8
         super(props);
9
+        this._saveContainerRef = this._saveContainerRef.bind(this);
9
         this._assertId(props);
10
         this._assertId(props);
10
         this._createState(props);
11
         this._createState(props);
11
       }
12
       }
23
         };
24
         };
24
       }
25
       }
25
 
26
 
27
+      _saveContainerRef(r) {
28
+        this.originalContainerRef = r;
29
+      }
30
+
26
       componentWillMount() {
31
       componentWillMount() {
27
         store.setRefForId(this.state.id, this);
32
         store.setRefForId(this.state.id, this);
28
       }
33
       }
52
       render() {
57
       render() {
53
         return (
58
         return (
54
           <OriginalContainer
59
           <OriginalContainer
55
-            ref={(r) => this.originalContainerRef = r}
60
+            ref={this._saveContainerRef}
56
             {...this.state.allProps}
61
             {...this.state.allProps}
57
             id={this.state.id}
62
             id={this.state.id}
58
             key={this.state.id}
63
             key={this.state.id}