id | title | layout | permalink | prev | next |
---|---|---|---|---|---|
use-react-with-other-libraries-ko-KR |
React와 다른 라이브러리를 함께 사용하기 |
tips |
use-react-with-other-libraries-ko-KR.html |
children-undefined-ko-KR.html |
dangerously-set-inner-html-ko-KR.html |
React만으로 만들 필요는 없습니다. 컴포넌트의 생명주기 이벤트, 특히 componentDidMount
와 componentDidUpdate
는 다른 라이브러리들의 로직을 넣기에 좋은 장소입니다.
var App = React.createClass({
getInitialState: function() {
return {myModel: new myBackboneModel({items: [1, 2, 3]})};
},
componentDidMount: function() {
$(this.refs.placeholder).append($('<span />'));
},
componentWillUnmount: function() {
// 정리는 여기서 합니다
},
shouldComponentUpdate: function() {
// 이 컴포넌트를 다시는 업데이트하지 않도록 하죠.
return false;
},
render: function() {
return <div ref="placeholder"/>;
}
});
ReactDOM.render(<App />, mountNode);