Skip to content

Commit

Permalink
Merge pull request #2859 from javawizard/patch-1
Browse files Browse the repository at this point in the history
ref-08-reconciliation.md: grammar/punctuation fixes
  • Loading branch information
chenglou authored and zpao committed Jan 17, 2015
1 parent 9a7cfb9 commit b8adf96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/docs/ref-08-reconciliation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ renderB: <Content />
=> [removeNode <Header />], [insertNode <Content />]
```

Having this high level knowledge is a very important aspect of why React diff algorithm is both fast and precise. It provides a good heuristic to quickly prune big parts of the tree and focus on parts likely to be similar.
Having this high level knowledge is a very important aspect of why React's diff algorithm is both fast and precise. It provides a good heuristic to quickly prune big parts of the tree and focus on parts likely to be similar.

It is very unlikely that a `<Header>` element is going generate a DOM that is going to look like what a `<Content>` would generate. Instead of spending time trying to match those two structures, React just re-builds the tree from scratch.
It is very unlikely that a `<Header>` element is going to generate a DOM that is going to look like what a `<Content>` would generate. Instead of spending time trying to match those two structures, React just re-builds the tree from scratch.

As a corollary, if there is a `<Header>` element at the same position in two consecutive renders, you would expect to see a very similar structure and it is worth exploring it.

Expand Down Expand Up @@ -121,7 +121,7 @@ In practice, finding a key is not really hard. Most of the time, the element you

## Trade-offs

It is important to remember that the reconciliation algorithm is an implementation detail. React could re-render the whole app on every action, the end-result would be the same. We are regularly refining the heuristics in order to make common use cases faster.
It is important to remember that the reconciliation algorithm is an implementation detail. React could re-render the whole app on every action; the end result would be the same. We are regularly refining the heuristics in order to make common use cases faster.

In the current implementation, you can express the fact that a sub-tree has been moved amongst its siblings, but you cannot tell that it has moved somewhere else. The algorithm will re-render that full sub-tree.

Expand Down

0 comments on commit b8adf96

Please sign in to comment.