Skip to content

Commit ffa032b

Browse files
committed
Update to latest
Includes #2419, #2428, #2418, #2443, #2433
1 parent 654b347 commit ffa032b

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

docs/interactivity-and-dynamic-uis.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ <h2><a class="anchor" name="a-simple-example"></a>A Simple Example <a class="has
406406

407407
<p>If you&#39;d like to use React on a touch device such as a phone or tablet, simply call <code>React.initializeTouchEvents(true);</code> to enable touch event handling.</p>
408408
<h2><a class="anchor" name="under-the-hood-autobinding-and-event-delegation"></a>Under the Hood: Autobinding and Event Delegation <a class="hash-link" href="#under-the-hood-autobinding-and-event-delegation">#</a></h2>
409-
<p>Under the hood React does a few things to keep your code performant and easy to understand.</p>
409+
<p>Under the hood, React does a few things to keep your code performant and easy to understand.</p>
410410

411-
<p><strong>Autobinding:</strong> When creating callbacks in JavaScript you usually need to explicitly bind a method to its instance such that the value of <code>this</code> is correct. With React, every method is automatically bound to its component instance. React caches the bound method such that it&#39;s extremely CPU and memory efficient. It&#39;s also less typing!</p>
411+
<p><strong>Autobinding:</strong> When creating callbacks in JavaScript, you usually need to explicitly bind a method to its instance such that the value of <code>this</code> is correct. With React, every method is automatically bound to its component instance. React caches the bound method such that it&#39;s extremely CPU and memory efficient. It&#39;s also less typing!</p>
412412

413413
<p><strong>Event delegation:</strong> React doesn&#39;t actually attach event handlers to the nodes themselves. When React starts up, it starts listening for all events at the top level using a single event listener. When a component is mounted or unmounted, the event handlers are simply added or removed from an internal mapping. When an event occurs, React knows how to dispatch it using this mapping. When there are no event handlers left in the mapping, React&#39;s event handlers are simple no-ops. To learn more about why this is fast, see <a href="http://davidwalsh.name/event-delegate">David Walsh&#39;s excellent blog post</a>.</p>
414414
<h2><a class="anchor" name="components-are-just-state-machines"></a>Components are Just State Machines <a class="hash-link" href="#components-are-just-state-machines">#</a></h2>

docs/jsx-spread.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ <h1>
379379
</h1>
380380
<div class="subHeader"></div>
381381

382-
<p>If you know all the properties that you want to place on a component a head of time, it is easy to use JSX:</p>
382+
<p>If you know all the properties that you want to place on a component ahead of time, it is easy to use JSX:</p>
383383
<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"> <span class="kd">var</span> <span class="nx">component</span> <span class="o">=</span> <span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">foo</span><span class="o">=</span><span class="p">{</span><span class="nx">x</span><span class="p">}</span> <span class="nx">bar</span><span class="o">=</span><span class="p">{</span><span class="nx">y</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">;</span>
384384
</code></pre></div><h2><a class="anchor" name="mutating-props-is-bad-mkay"></a>Mutating Props is Bad, mkay <a class="hash-link" href="#mutating-props-is-bad-mkay">#</a></h2>
385385
<p>If you don&#39;t know which properties you want to set, you might be tempted to add them onto the object later:</p>

docs/transferring-props.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ <h2><a class="anchor" name="manual-transfer"></a>Manual Transfer <a class="hash-
400400
<span class="p">);</span>
401401
<span class="p">}</span>
402402
<span class="p">});</span>
403-
<span class="nx">React</span><span class="p">.</span><span class="nx">renderComponent</span><span class="p">(</span>
403+
<span class="nx">React</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span>
404404
<span class="o">&lt;</span><span class="nx">FancyCheckbox</span> <span class="nx">checked</span><span class="o">=</span><span class="p">{</span><span class="kc">true</span><span class="p">}</span> <span class="nx">onClick</span><span class="o">=</span><span class="p">{</span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">}</span><span class="o">&gt;</span>
405405
<span class="nx">Hello</span> <span class="nx">world</span><span class="o">!</span>
406406
<span class="o">&lt;</span><span class="err">/FancyCheckbox&gt;,</span>
@@ -425,7 +425,7 @@ <h2><a class="anchor" name="transferring-with-...-in-jsx"></a>Transferring with
425425
<span class="p">);</span>
426426
<span class="p">}</span>
427427
<span class="p">});</span>
428-
<span class="nx">React</span><span class="p">.</span><span class="nx">renderComponent</span><span class="p">(</span>
428+
<span class="nx">React</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span>
429429
<span class="o">&lt;</span><span class="nx">FancyCheckbox</span> <span class="nx">checked</span><span class="o">=</span><span class="p">{</span><span class="kc">true</span><span class="p">}</span> <span class="nx">onClick</span><span class="o">=</span><span class="p">{</span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">}</span><span class="o">&gt;</span>
430430
<span class="nx">Hello</span> <span class="nx">world</span><span class="o">!</span>
431431
<span class="o">&lt;</span><span class="err">/FancyCheckbox&gt;,</span>

docs/tutorial.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ <h1>
399399
<h3><a class="anchor" name="want-to-skip-all-this-and-just-see-the-source"></a>Want to skip all this and just see the source? <a class="hash-link" href="#want-to-skip-all-this-and-just-see-the-source">#</a></h3>
400400
<p><a href="https://github.com/reactjs/react-tutorial">It&#39;s all on GitHub.</a></p>
401401
<h3><a class="anchor" name="getting-started"></a>Getting started <a class="hash-link" href="#getting-started">#</a></h3>
402-
<p>For this tutorial we&#39;ll use prebuilt JavaScript files on a CDN. Open up your favorite editor and create a new HTML document:</p>
402+
<p>For this tutorial, we&#39;ll use prebuilt JavaScript files on a CDN. Open up your favorite editor and create a new HTML document:</p>
403403
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="c">&lt;!-- template.html --&gt;</span>
404404
<span class="nt">&lt;html&gt;</span>
405405
<span class="nt">&lt;head&gt;</span>

js/jsfiddle-integration.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function() {
2+
var tag = document.querySelector(
3+
'script[type="application/javascript;version=1.7"]'
4+
);
5+
if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
6+
alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
7+
}
8+
tag.setAttribute('type', 'text/jsx;harmony=true');
9+
tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
10+
})();
11+

tips/if-else-in-JSX.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ <h1>If-Else in JSX</h1>
387387
<span class="o">&lt;</span><span class="nx">div</span> <span class="nx">id</span><span class="o">=</span><span class="p">{</span><span class="k">if</span> <span class="p">(</span><span class="nx">condition</span><span class="p">)</span> <span class="p">{</span> <span class="s1">&#39;msg&#39;</span> <span class="p">}}</span><span class="o">&gt;</span><span class="nx">Hello</span> <span class="nx">World</span><span class="o">!&lt;</span><span class="err">/div&gt;</span>
388388

389389
<span class="c1">// Is transformed to this JS:</span>
390-
<span class="nx">React</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;dov&quot;</span><span class="p">,</span> <span class="p">{</span><span class="nx">id</span><span class="o">:</span> <span class="k">if</span> <span class="p">(</span><span class="nx">condition</span><span class="p">)</span> <span class="p">{</span> <span class="s1">&#39;msg&#39;</span> <span class="p">}},</span> <span class="s2">&quot;Hello World!&quot;</span><span class="p">);</span>
390+
<span class="nx">React</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s2">&quot;div&quot;</span><span class="p">,</span> <span class="p">{</span><span class="nx">id</span><span class="o">:</span> <span class="k">if</span> <span class="p">(</span><span class="nx">condition</span><span class="p">)</span> <span class="p">{</span> <span class="s1">&#39;msg&#39;</span> <span class="p">}},</span> <span class="s2">&quot;Hello World!&quot;</span><span class="p">);</span>
391391
</code></pre></div>
392392
<p>That&#39;s not valid JS. You probably want to make use of a ternary expression:</p>
393393
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="nx">React</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">div</span> <span class="nx">id</span><span class="o">=</span><span class="p">{</span><span class="nx">condition</span> <span class="o">?</span> <span class="s1">&#39;msg&#39;</span> <span class="o">:</span> <span class="s1">&#39;&#39;</span><span class="p">}</span><span class="o">&gt;</span><span class="nx">Hello</span> <span class="nx">World</span><span class="o">!&lt;</span><span class="err">/div&gt;, mountNode);</span>

0 commit comments

Comments
 (0)