Skip to content

Commit 6b63245

Browse files
author
Eduardo García Sanz
committed
fixed event unmount bug
1 parent b241c47 commit 6b63245

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage" : "https://github.com/coma/react-socket",
55
"repository" : "https://github.com/coma/react-socket",
66
"main" : "./src/index.js",
7-
"version" : "0.1.1",
7+
"version" : "0.1.2",
88
"license" : "MIT",
99
"private" : false,
1010
"authors" : [

src/event.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ module.exports = React.createClass({
1616
},
1717
componentWillMount : function () {
1818

19-
Socket(this.props.socket)
20-
.on(this.props.name, this.props.callback);
19+
this.socket = Socket(this.props.socket);
20+
this.socket.on(this.props.name, this.props.callback);
2121
},
2222
componentWillUnmount: function () {
2323

24-
Socket(this.props.socket)
25-
.off(this.props.name, this.props.callback);
24+
this.socket.off(this.props.name, this.props.callback);
2625
},
2726
render : function () {
2827

0 commit comments

Comments
 (0)