Tôi mới trong js phản ứng.sự khác biệt giữa getDefaultProps và getInitialState phản ứng js
getDefaultProps() {
return {
backgroundColor: 'gray',
height: 200,
width: 200
}
},
Tôi đã cùng một giá trị cho getDefaultProps
và cho getInitialState
:
getInitialState() {
return {
backgroundColor: 'gray',
height: 200,
width: 200
}
},
chênh lệch hợp lý giữa cả hai là gì. nên ghi đè hoặc cái nào sẽ thực thi trước.
Cảm ơn.
https://www.google.com/search?btnG=1&pws=0&q=difference+between+state+and+props – StackOverMySoul