@samitouri / QOS-React-2 / commits / 1e56800543

shrink working on props in state entry

Cheng Lou committed Oct 5, 2013 at 14:35 UTC 1e56800543e7383cd4051bb8376976047fd5ab84
2 files changed +4 -4
docs/cookbook/cb-10-props-in-getInitialSate-as-anti-pattern-tip.md
+2 -2
@@ -7,7 +7,7 @@ permalink: props-in-getInitialSate-as-anti-pattern-tip.html
7
8 > Note:
9 >
10 -> This is not really a React-specific tip, as such anti-patterns often occur in code in general; in this case, React simply points them out more clearly.
10 +> This isn't really a React-specific tip, as such anti-patterns often occur in code in general; in this case, React simply points them out more clearly.
11
12 Using props, passed down from parent, to generate state in `getInitialState` often leads to duplication of "source of truth", i.e. where the real data is. Whenever possible, compute values on-the-fly to ensure that they don't get out of sync later on and cause maintenance trouble.
13
@@ -42,7 +42,7 @@ var MessageBox = React.createClass({
42 React.renderComponent(<MessageBox name="Zuck"/>, mountNode);
43 ```
44
45 -Also works, for larger logic:
45 +For more complex logic:
46
47 ```js
48 /** @jsx React.DOM */
docs/cookbook/cb-10-props-in-getInitialSate-as-anti-pattern.md
+2 -2
@@ -38,7 +38,7 @@ var MessageBox = React.createClass({
38 React.renderComponent(<MessageBox name="Zuck"/>, mountNode);
39 ```
40
41 -Or, if the logic's big, isolate it so:
41 +For more complex logic:
42
43 ```js
44 /** @jsx React.DOM */
@@ -56,6 +56,6 @@ React.renderComponent(<MessageBox name="Zuck"/>, mountNode);
56 ```
57
58 ### Discussion
59 -This is not really a React-specific tip, as such anti-patterns often occur in code in general; in this case, React simply points them out more clearly.
59 +This isn't really a React-specific tip, as such anti-patterns often occur in code in general; in this case, React simply points them out more clearly.
60
61 Using props, passed down from parent, to generate state often leads to duplication of "source of truth", i.e. where the real data is. Whenever possible, compute values on-the-fly to ensure that they don't get out of sync later on and cause maintenance trouble.