2018 5 28

###normalizr--JSON數據範式化 api文檔html

中文文檔react

用途git

  • 開發複雜的應用時,不可避免會有一些數據相互引用。建議你儘量地把 state 範式化,不存在嵌套。把全部數據放到一個對象裏,每一個數據以 ID 爲主鍵,不一樣數據相互引用時經過 ID 來查找。把 應用的 state 想像成數據庫
  • normalizr:將嵌套的JSON格式扁平化,方便被Redux利用

###bindactioncreatorsgithub

###Enzyme單元測試數據庫

ReactCSSTransitionGroup動畫組件

ReactCSSTransitionGroupredux

###一個有趣的react demo 教你如何處理樹形結構 一個有趣的react demo 教你如何處理樹形結構 segmentfault

props or state changes高性能的React組件api

office破解

jsx行間寫法性能

style={ {
      textDecoration: completed ? 'line-through' : 'none'
    }}
複製代碼

###經典例子單元測試

function formatDate(date) {
  return date.toLocaleDateString();
}

function Comment(props) {
  return (
    <div className="Comment">
      <div className="UserInfo">
        <img className="Avatar"
             src={props.author.avatarUrl}
             alt={props.author.name} />
        <div className="UserInfo-name">
          {props.author.name}
        </div>
      </div>
      <div className="Comment-text">
        {props.text}
      </div>
      <div className="Comment-date">
        {formatDate(props.date)}
      </div>
    </div>
  );
}

const comment = {
  date: new Date(),
  text: 'I hope you enjoy learning React!',
  author: {
    name: 'Hello Kitty',
    avatarUrl: 'http://placekitten.com/g/64/64'
  }
};

ReactDOM.render(
  <Comment
    date={comment.date}
    text={comment.text}
    author={comment.author} />,
  document.getElementById('root')
);
複製代碼

###react項目總結

相關文章
相關標籤/搜索