搜尋
  • 登入
  • 報名
密碼重置成功

關注您感興趣的項目並了解有關它們的最新消息

程式設計字典

服務程式設計師的線上技術手冊
熱門搜尋:
React Props 使用方法詳細解說

React Props

中文翻譯 最近更新: 2018-06-21 11:24:17

state 和 props 主要的差異在於 props 是不可變的,而 state 可以根據與使用者互動來改變。

React Props 語法

state 和 props 主要的差異在於 props 是不可變的,而 state 可以根據與使用者互動來改變。

React Props 範例

var HelloMessage = React.createClass({
  render: function() {
    return <h1>Hello {this.props.name}</h1>;  }}); 
ReactDOM.render(
  <HelloMessage name="php.cn" />,  document.getElementById('example')


React Props