모든 요청에 대해 서버의 반응 구성 요소를 렌더링하는 기존 코드가 있는데, 이는 메모리 누수가 있음을 분명히합니다. 이 코드에 문제가 코너를 가지고 : 나는 모든에 this
개체가 새로운 청취자를 저장하는 요청 있다고 생각React Component with Memory Leak
componentWillMount: function() {
var onLogin = this.props.onLogin || function() {},
onLogout = this.props.onLogout || function() {};
this.on('authChange', function() {
console.log('user authenticated:', this.state.isAuthenticated);
return this.state.isAuthenticated
? onLogin(this.state)
: onLogout(this.state);
}.bind(this));
},
,하지만 난 왜 this
요소는 쓰레기 때로 표시되지 않는되지 않습니다 구성 요소의 렌더링이 완료됩니다.
'renderToString()'함수가 완료되면 어쨌든'this' 컴포넌트가 쓰레기로 표시되지 않아야합니까? –