Skip to content

Commit e3a3dec

Browse files
committed
Move variables out of state.
1 parent 700515c commit e3a3dec

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎src/components/views/rooms/RoomTooltip.js‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ module.exports = React.createClass({
4343
document.body.appendChild(this.tooltipContainer);
4444
window.addEventListener('scroll', this._renderTooltip, true);
4545

46-
const parent = ReactDOM.findDOMNode(this).parentNode;
47-
this.state={
48-
parent,
49-
parentBox: parent.getBoundingClientRect(),
50-
};
46+
this.parent = ReactDOM.findDOMNode(this).parentNode;
5147

5248
this._renderTooltip();
5349
},
@@ -70,7 +66,7 @@ module.exports = React.createClass({
7066
},
7167

7268
_updatePosition(style) {
73-
const parentBox = this.state.parent.getBoundingClientRect();
69+
const parentBox = this.parent.getBoundingClientRect();
7470
let offset = 0;
7571
if (parentBox.height > MIN_TOOLTIP_HEIGHT) {
7672
offset = Math.floor((parentBox.height - MIN_TOOLTIP_HEIGHT) / 2);
@@ -117,8 +113,8 @@ module.exports = React.createClass({
117113
render: function() {
118114
// Render a placeholder
119115
return (
120-
<div className={ this.props.className } >
116+
<div className={this.props.className} >
121117
</div>
122118
);
123-
}
119+
},
124120
});

0 commit comments

Comments
 (0)