setState 与 生命周期的问题

#1
class App extends React.Component {
	
	constructor() {
		super();
		
		this.state = {
			ListData: {}
		}
	}
	
	componentDidMount() {
		console.log(1)
		var url = 'http://a.com/api'

		reqwest({
			url: url,
			type: 'jsonp',
			data: {
				page: 1,
				os: 16,
				withext: 1
			},
			success: (e) =>{
				var appListData = e.data
				this.setState({
					appListData: appListData
				});
			}
		})
	}
	

	render() {
		console.log(2)
		
		return (
			<div>
			   
			</div>
		)
	}
}

现在 控制台输出 2 1 2

最后一个2是 setState 时输出的么?这样的话会render2次,感觉不是很好,又什么好办法么?

#2

每次setState都会触发render,没什么不好,这就是react的特性

#3

shouldComponentUpdate

文档:https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate

中文解说:http://blog.csdn.net/jjx0224/article/details/49869597