forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeed.xml
More file actions
772 lines (664 loc) · 110 KB
/
feed.xml
File metadata and controls
772 lines (664 loc) · 110 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>React</title>
<description>A JavaScript library for building user interfaces</description>
<link>https://facebook.github.io/react</link>
<atom:link href="https://facebook.github.io/react/feed.xml" rel="self" type="application/rss+xml" />
<item>
<title>Discontinuing IE 8 Support in React DOM</title>
<description><p>Since its 2013 release, React has supported all popular browsers, including Internet Explorer 8 and above. We handle normalizing many quirks present in old browser versions, including event system differences, so that your app code doesn&#39;t have to worry about most browser bugs.</p>
<p>Today, Microsoft <a href="https://www.microsoft.com/en-us/WindowsForBusiness/End-of-IE-support">discontinued support for older versions of IE</a>. Starting with React v15, we&#39;re discontinuing React DOM&#39;s support for IE 8. We&#39;ve heard that most React DOM apps already don&#39;t support old versions of Internet Explorer, so this shouldn&#39;t affect many people. This change will help us develop faster and make React DOM even better. (We won&#39;t actively remove IE 8–related code quite yet, but we will deprioritize new bugs that are reported. If you need to support IE 8 we recommend you stay on React v0.14.)</p>
<p>React DOM will continue to support IE 9 and above for the foreseeable future.</p>
</description>
<pubDate>2016-01-12T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2016/01/12/discontinuing-ie8-support.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/01/12/discontinuing-ie8-support.html</guid>
</item>
<item>
<title>(A => B) !=> (B => A)</title>
<description><p>The documentation for <code>componentWillReceiveProps</code> states that <code>componentWillReceiveProps</code> will be invoked when the props change as the result of a rerender. Some people assume this means &quot;if <code>componentWillReceiveProps</code> is called, then the props must have changed&quot;, but that conclusion is logically incorrect.</p>
<p>The guiding principle is one of my favorites from formal logic/mathematics:</p>
<blockquote>
<p>A implies B does not imply B implies A</p>
</blockquote>
<p>Example: &quot;If I eat moldy food, then I will get sick&quot; does not imply &quot;if I am sick, then I must have eaten moldy food&quot;. There are many other reasons I could be feeling sick. For instance, maybe the flu is circulating around the office. Similarly, there are many reasons that <code>componentWillReceiveProps</code> might get called, even if the props didn’t change.</p>
<p>If you don’t believe me, call <code>ReactDOM.render()</code> three times with the exact same props, and try to predict the number of times <code>componentWillReceiveProps</code> will get called:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">class</span> <span class="nx">Component</span> <span class="kr">extends</span> <span class="nx">React</span><span class="p">.</span><span class="nx">Component</span> <span class="p">{</span>
<span class="nx">componentWillReceiveProps</span><span class="p">(</span><span class="nx">nextProps</span><span class="p">)</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="s1">&#39;componentWillReceiveProps&#39;</span><span class="p">,</span> <span class="nx">nextProps</span><span class="p">.</span><span class="nx">data</span><span class="p">.</span><span class="nx">bar</span><span class="p">);</span>
<span class="p">}</span>
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="o">&lt;</span><span class="nx">div</span><span class="o">&gt;</span><span class="nx">Bar</span> <span class="p">{</span><span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">data</span><span class="p">.</span><span class="nx">bar</span><span class="p">}</span><span class="o">!&lt;</span><span class="err">/div&gt;;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="kd">var</span> <span class="nx">container</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">&#39;container&#39;</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">mydata</span> <span class="o">=</span> <span class="p">{</span><span class="nx">bar</span><span class="o">:</span> <span class="s1">&#39;drinks&#39;</span><span class="p">};</span>
<span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">data</span><span class="o">=</span><span class="p">{</span><span class="nx">mydata</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
<span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">data</span><span class="o">=</span><span class="p">{</span><span class="nx">mydata</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
<span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">data</span><span class="o">=</span><span class="p">{</span><span class="nx">mydata</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
</code></pre></div>
<p>In this case, the answer is &quot;2&quot;. React calls <code>componentWillReceiveProps</code> twice (once for each of the two updates). Both times, the value of &quot;drinks&quot; is printed (ie. the props didn’t change).</p>
<p>To understand why, we need to think about what <em>could</em> have happened. The data <em>could</em> have changed between the initial render and the two subsequent updates, if the code had performed a mutation like this:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">mydata</span> <span class="o">=</span> <span class="p">{</span><span class="nx">bar</span><span class="o">:</span> <span class="s1">&#39;drinks&#39;</span><span class="p">};</span>
<span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">data</span><span class="o">=</span><span class="p">{</span><span class="nx">mydata</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
<span class="nx">mydata</span><span class="p">.</span><span class="nx">bar</span> <span class="o">=</span> <span class="s1">&#39;food&#39;</span>
<span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">data</span><span class="o">=</span><span class="p">{</span><span class="nx">mydata</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
<span class="nx">mydata</span><span class="p">.</span><span class="nx">bar</span> <span class="o">=</span> <span class="s1">&#39;noise&#39;</span>
<span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">Component</span> <span class="nx">data</span><span class="o">=</span><span class="p">{</span><span class="nx">mydata</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
</code></pre></div>
<p>React has no way of knowing that the data didn’t change. Therefore, React needs to call <code>componentWillReceiveProps</code>, because the component needs to be notified of the new props (even if the new props happen to be the same as the old props).</p>
<p>You might think that React could just use smarter checks for equality, but there are some issues with this idea:</p>
<ul>
<li>The old <code>mydata</code> and the new <code>mydata</code> are actually the same physical object (only the object’s internal value changed). Since the references are triple-equals-equal, doing an equality check doesn’t tell us if the value has changed. The only possible solution would be to have created a deep copy of the data, and then later do a deep comparison - but this can be prohibitively expensive for large data structures (especially ones with cycles).</li>
<li>The <code>mydata</code> object might contain references to functions which have captured variables within closures. There is no way for React to peek into these closures, and thus no way for React to copy them and/or verify equality.</li>
<li>The <code>mydata</code> object might contain references to objects which are re-instantiated during the parent&#39;s render (ie. not triple-equals-equal) but are conceptually equal (ie. same keys and same values). A deep-compare (expensive) could detect this, except that functions present a problem again because there is no reliable way to compare two functions to see if they are semantically equivalent.</li>
</ul>
<p>Given the language constraints, it is sometimes impossible for us to achieve meaningful equality semantics. In such cases, React will call <code>componentWillReceiveProps</code> (even though the props might not have changed) so the component has an opportunity to examine the new props and act accordingly.</p>
<p>As a result, your implementation of <code>componentWillReceiveProps</code> MUST NOT assume that your props have changed. If you want an operation (such as a network request) to occur only when props have changed, your <code>componentWillReceiveProps</code> code needs to check to see if the props actually changed.</p>
</description>
<pubDate>2016-01-08T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2016/01/08/A-implies-B-does-not-imply-B-implies-A.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/01/08/A-implies-B-does-not-imply-B-implies-A.html</guid>
</item>
<item>
<title>React v0.14.4</title>
<description><p>Happy December! We have a minor point release today. It has just a few small bug fixes.</p>
<p>The release is now available for download:</p>
<ul>
<li><strong>React</strong><br>
Dev build with warnings: <a href="https://fb.me/react-0.14.4.js">https://fb.me/react-0.14.4.js</a><br>
Minified build for production: <a href="https://fb.me/react-0.14.4.min.js">https://fb.me/react-0.14.4.min.js</a><br></li>
<li><strong>React with Add-Ons</strong><br>
Dev build with warnings: <a href="https://fb.me/react-with-addons-0.14.4.js">https://fb.me/react-with-addons-0.14.4.js</a><br>
Minified build for production: <a href="https://fb.me/react-with-addons-0.14.4.min.js">https://fb.me/react-with-addons-0.14.4.min.js</a><br></li>
<li><strong>React DOM</strong> (include React in the page before React DOM)<br>
Dev build with warnings: <a href="https://fb.me/react-dom-0.14.4.js">https://fb.me/react-dom-0.14.4.js</a><br>
Minified build for production: <a href="https://fb.me/react-dom-0.14.4.min.js">https://fb.me/react-dom-0.14.4.min.js</a><br></li>
<li><strong>React DOM Server</strong> (include React in the page before React DOM Server)<br>
Dev build with warnings: <a href="https://fb.me/react-dom-server-0.14.4.js">https://fb.me/react-dom-server-0.14.4.js</a><br>
Minified build for production: <a href="https://fb.me/react-dom-server-0.14.4.min.js">https://fb.me/react-dom-server-0.14.4.min.js</a><br></li>
</ul>
<p>We&#39;ve also published version <code>0.14.4</code> of the <code>react</code>, <code>react-dom</code>, and addons packages on npm and the <code>react</code> package on bower.</p>
<hr>
<h2><a class="anchor" name="changelog"></a>Changelog <a class="hash-link" href="#changelog">#</a></h2><h3><a class="anchor" name="react"></a>React <a class="hash-link" href="#react">#</a></h3>
<ul>
<li>Minor internal changes for better compatibility with React Native</li>
</ul>
<h3><a class="anchor" name="react-dom"></a>React DOM <a class="hash-link" href="#react-dom">#</a></h3>
<ul>
<li>The <code>autoCapitalize</code> and <code>autoCorrect</code> props are now set as attributes in the DOM instead of properties to improve cross-browser compatibility</li>
<li>Fixed bug with controlled <code>&lt;select&gt;</code> elements not handling updates properly</li>
</ul>
<h3><a class="anchor" name="react-perf-add-on"></a>React Perf Add-on <a class="hash-link" href="#react-perf-add-on">#</a></h3>
<ul>
<li>Some DOM operation names have been updated for clarity in the output of <code>.printDOM()</code></li>
</ul>
</description>
<pubDate>2015-12-29T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/29/react-v0.14.4.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/29/react-v0.14.4.html</guid>
</item>
<item>
<title>React Components, Elements, and Instances</title>
<description><p>The difference between <strong>components, their instances, and elements</strong> confuses many React beginners. Why are there three different terms to refer to something that is painted on screen?</p>
<h2><a class="anchor" name="managing-the-instances"></a>Managing the Instances <a class="hash-link" href="#managing-the-instances">#</a></h2>
<p>If you’re new to React, you probably only worked with component classes and instances before. For example, you may declare a <code>Button</code> <em>component</em> by creating a class. When the app is running, you may have several <em>instances</em> of this component on screen, each with its own properties and local state. This is the traditional object-oriented UI programming. Why introduce <em>elements</em>?</p>
<p>In this traditional UI model, it is up to you to take care of creating and destroying child component instances. If a <code>Form</code> component wants to render a <code>Button</code> component, it needs to create its instance, and manually keep it up to date with any new information.</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">class</span> <span class="nx">Form</span> <span class="kr">extends</span> <span class="nx">TraditionalObjectOrientedView</span> <span class="p">{</span>
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">// Read some data passed to the view</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">isSubmitted</span><span class="p">,</span> <span class="nx">buttonText</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">attrs</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">isSubmitted</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Form is not yet submitted. Create the button!</span>
<span class="k">this</span><span class="p">.</span><span class="nx">button</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Button</span><span class="p">({</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">buttonText</span><span class="p">,</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;blue&#39;</span>
<span class="p">});</span>
<span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">.</span><span class="nx">el</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// The button is visible. Update its text!</span>
<span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">.</span><span class="nx">attrs</span><span class="p">.</span><span class="nx">children</span> <span class="o">=</span> <span class="nx">buttonText</span><span class="p">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">.</span><span class="nx">render</span><span class="p">();</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">isSubmitted</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Form was submitted. Destroy the button!</span>
<span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">removeChild</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">.</span><span class="nx">el</span><span class="p">);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">button</span><span class="p">.</span><span class="nx">destroy</span><span class="p">();</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">isSubmitted</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">message</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Form was submitted. Show the success message!</span>
<span class="k">this</span><span class="p">.</span><span class="nx">message</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Message</span><span class="p">({</span> <span class="nx">text</span><span class="o">:</span> <span class="s1">&#39;Success!&#39;</span> <span class="p">});</span>
<span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">message</span><span class="p">.</span><span class="nx">el</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>This is pseudocode, but it is more or less what you end up with when you write composite UI code that behaves consistently in an object-oriented way using a library like Backbone.</p>
<p>Each component instance has to keep references to its DOM node and to the instances of the children components, and create, update, and destroy them when the time is right. The lines of code grow as the square of the number of possible states of the component, and the parents have direct access to their children component instances, making it hard to decouple them in the future.</p>
<p>So how is React different?</p>
<h2><a class="anchor" name="elements-describe-the-tree"></a>Elements Describe the Tree <a class="hash-link" href="#elements-describe-the-tree">#</a></h2>
<p>In React, this is where the <em>elements</em> come to rescue. <strong>An element is a plain object <em>describing</em> a component instance or DOM node and its desired properties.</strong> It contains only information about the component type (for example, a <code>Button</code>), its properties (for example, its <code>color</code>), and any child elements inside it.</p>
<p>An element is not an actual instance. Rather, it is a way to tell React what you <em>want</em> to see on the screen. You can’t call any methods on the element. It’s just an immutable description object with two fields: <code>type: (string | ReactClass)</code> and <code>props: Object</code><sup id="fnref1"><a href="#fn1" rel="footnote">1</a></sup>.</p>
<h3><a class="anchor" name="dom-elements"></a>DOM Elements <a class="hash-link" href="#dom-elements">#</a></h3>
<p>When an element’s <code>type</code> is a string, it represents a DOM node with that tag name, and <code>props</code> correspond to its attributes. This is what React will render. For example:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;button&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">&#39;button button-blue&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>This element is just a way to represent the following HTML as a plain object:</p>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;button</span> <span class="na">class=</span><span class="s">&#39;button button-blue&#39;</span><span class="nt">&gt;</span>
<span class="nt">&lt;b&gt;</span>
OK!
<span class="nt">&lt;/b&gt;</span>
<span class="nt">&lt;/button&gt;</span>
</code></pre></div>
<p>Note how elements can be nested. By convention, when we want to create an element tree, we specify one or more child elements as the <code>children</code> prop of their containing element.</p>
<p>What’s important is that both child and parent elements are <em>just descriptions and not the actual instances</em>. They don’t refer to anything on the screen when you create them. You can create them and throw them away, and it won’t matter much.</p>
<p>React elements are easy to traverse, don’t need to be parsed, and of course they are much lighter than the actual DOM elements—they’re just objects!</p>
<h3><a class="anchor" name="component-elements"></a>Component Elements <a class="hash-link" href="#component-elements">#</a></h3>
<p>However, the <code>type</code> of an element can also be a function or a class corresponding to a React component:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;blue&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>This is the core idea of React.</p>
<p><strong>An element describing a component is also an element, just like an element describing the DOM node. They can be nested and mixed with each other.</strong></p>
<p>This feature lets you define a <code>DangerButton</code> component as a <code>Button</code> with a specific <code>color</code> property value without worrying about whether <code>Button</code> renders to a DOM <code>&lt;button&gt;</code>, a <code>&lt;div&gt;</code>, or something else entirely:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">const</span> <span class="nx">DangerButton</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">({</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;red&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">children</span>
<span class="p">}</span>
<span class="p">});</span>
</code></pre></div>
<p>You can mix and match DOM and component elements in a single element tree:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">const</span> <span class="nx">DeleteAccount</span> <span class="o">=</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">({</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;div&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">[{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;p&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;Are you sure?&#39;</span>
<span class="p">}</span>
<span class="p">},</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">DangerButton</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;Yep&#39;</span>
<span class="p">}</span>
<span class="p">},</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;blue&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;Cancel&#39;</span>
<span class="p">}</span>
<span class="p">}]</span>
<span class="p">});</span>
</code></pre></div>
<p>Or, if you prefer JSX:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">const</span> <span class="nx">DeleteAccount</span> <span class="o">=</span> <span class="p">()</span> <span class="o">=&gt;</span> <span class="p">(</span>
<span class="o">&lt;</span><span class="nx">div</span><span class="o">&gt;</span>
<span class="o">&lt;</span><span class="nx">p</span><span class="o">&gt;</span><span class="nx">Are</span> <span class="nx">you</span> <span class="nx">sure</span><span class="o">?&lt;</span><span class="err">/p&gt;</span>
<span class="o">&lt;</span><span class="nx">DangerButton</span><span class="o">&gt;</span><span class="nx">Yep</span><span class="o">&lt;</span><span class="err">/DangerButton&gt;</span>
<span class="o">&lt;</span><span class="nx">Button</span> <span class="nx">color</span><span class="o">=</span><span class="s1">&#39;blue&#39;</span><span class="o">&gt;</span><span class="nx">Cancel</span><span class="o">&lt;</span><span class="err">/Button&gt;</span>
<span class="o">&lt;</span><span class="err">/div&gt;</span>
<span class="p">);</span>
</code></pre></div>
<p>This mix and matching helps keep components decoupled from each other, as they can express both <em>is-a</em> and <em>has-a</em> relationships exclusively through composition:</p>
<ul>
<li><code>Button</code> is a DOM <code>&lt;button&gt;</code> with specific properties.</li>
<li><code>DangerButton</code> is a <code>Button</code> with specific properties.</li>
<li><code>DeleteAccount</code> contains a <code>Button</code> and a <code>DangerButton</code> inside a <code>&lt;div&gt;</code>.</li>
</ul>
<h3><a class="anchor" name="components-encapsulate-element-trees"></a>Components Encapsulate Element Trees <a class="hash-link" href="#components-encapsulate-element-trees">#</a></h3>
<p>When React sees an element with a function or class <code>type</code>, it knows to ask <em>that</em> component what element it renders to, given the corresponding <code>props</code>.</p>
<p>When it sees this element:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;blue&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>React will ask <code>Button</code> what it renders to. The <code>Button</code> will return this element:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;button&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">&#39;button button-blue&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>React will repeat this process until it knows the underlying DOM tag elements for every component on the page.</p>
<p>React is like a child asking “what is Y” for every “X is Y” you explain to them until they figure out every little thing in the world.</p>
<p>Remember the <code>Form</code> example above? It can be written in React as follows<sup id="fnref1"><a href="#fn1" rel="footnote">1</a></sup>:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">const</span> <span class="nx">Form</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">isSubmitted</span><span class="p">,</span> <span class="nx">buttonText</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">isSubmitted</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Form submitted! Return a message element.</span>
<span class="k">return</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Message</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">text</span><span class="o">:</span> <span class="s1">&#39;Success!&#39;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="c1">// Form is still visible! Return a button element.</span>
<span class="k">return</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">buttonText</span><span class="p">,</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;blue&#39;</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">};</span>
</code></pre></div>
<p>That’s it! For a React component, props are the input, and an element tree is the output.</p>
<p><strong>The returned element tree can contain both elements describing DOM nodes, and elements describing other components. This lets you compose independent parts of UI without relying on their internal DOM structure.</strong></p>
<p>We let React create, update, and destroy instances. We <em>describe</em> them with elements we return from the components, and React takes care of managing the instances.</p>
<h3><a class="anchor" name="components-can-be-classes-or-functions"></a>Components Can Be Classes or Functions <a class="hash-link" href="#components-can-be-classes-or-functions">#</a></h3>
<p>In the code above, <code>Form</code>, <code>Message</code>, and <code>Button</code> are React components. They can either be written as functions, like above, or as classes descending from <code>React.Component</code>. These three ways to declare a component are mostly equivalent:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="c1">// 1) As a function of props</span>
<span class="kr">const</span> <span class="nx">Button</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span><span class="p">,</span> <span class="nx">color</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">({</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;button&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">&#39;button button-&#39;</span> <span class="o">+</span> <span class="nx">color</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">children</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="c1">// 2) Using the React.createClass() factory</span>
<span class="kr">const</span> <span class="nx">Button</span> <span class="o">=</span> <span class="nx">React</span><span class="p">.</span><span class="nx">createClass</span><span class="p">({</span>
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">children</span><span class="p">,</span> <span class="nx">color</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="k">return</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;button&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">&#39;button button-&#39;</span> <span class="o">+</span> <span class="nx">color</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">children</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="c1">// 3) As an ES6 class descending from React.Component</span>
<span class="kr">class</span> <span class="nx">Button</span> <span class="kr">extends</span> <span class="nx">React</span><span class="p">.</span><span class="nx">Component</span> <span class="p">{</span>
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">children</span><span class="p">,</span> <span class="nx">color</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="k">return</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;button&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">&#39;button button-&#39;</span> <span class="o">+</span> <span class="nx">color</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">children</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>When a component is defined as a class, it is a little bit more powerful than a functional component. It can store some local state and perform custom logic when the corresponding DOM node is created or destroyed.</p>
<p>A functional component is less powerful but is simpler, and acts like a class component with just a single <code>render()</code> method. Unless you need features available only in a class, we encourage you to use functional components instead.</p>
<p><strong>However, whether functions or classes, fundamentally they are all components to React. They take the props as their input, and return the elements as their output.</strong></p>
<h3><a class="anchor" name="top-down-reconciliation"></a>Top-Down Reconciliation <a class="hash-link" href="#top-down-reconciliation">#</a></h3>
<p>When you call:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">({</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Form</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">isSubmitted</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="nx">buttonText</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">},</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">&#39;root&#39;</span><span class="p">));</span>
</code></pre></div>
<p>React will ask the <code>Form</code> component what element tree it returns, given those <code>props</code>. It will gradually “refine” its understanding of your component tree in terms of simpler primitives:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="c1">// React: You told me this...</span>
<span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Form</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">isSubmitted</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="nx">buttonText</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="c1">// React: ...And Form told me this...</span>
<span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span><span class="p">,</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">&#39;blue&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="c1">// React: ...and Button told me this! I guess I&#39;m done.</span>
<span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;button&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">&#39;button button-blue&#39;</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">&#39;OK!&#39;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>This is a part of the process that React calls <a href="/react/docs/reconciliation.html">reconciliation</a> which starts when you call <a href="/react/docs/top-level-api.html#reactdom.render"><code>ReactDOM.render()</code></a> or <a href="/react/docs/component-api.html#setstate"><code>setState()</code></a>. By the end of the reconciliation, React knows the result DOM tree, and a renderer like <code>react-dom</code> or <code>react-native</code> applies the minimal set of changes necessary to update the DOM nodes (or the platform-specific views in case of React Native).</p>
<p>This gradual refining process is also the reason React apps are easy to optimize. If some parts of your component tree become too large for React to visit efficiently, you can tell it to <a href="/react/docs/advanced-performance.html">skip this “refining” and diffing certain parts of the tree if the relevant props have not changed</a>. It is very fast to calculate whether the props have changed if they are immutable, so React and immutability work great together, and can provide great optimizations with the minimal effort.</p>
<p>You might have noticed that this blog entry talks a lot about components and elements, and not so much about the instances. The truth is, instances have much less importance in React than in most object-oriented UI frameworks.</p>
<p>Only components declared as classes have instances, and you never create them directly: React does that for you. While <a href="/react/docs/more-about-refs.html">mechanisms for a parent component instance to access a child component instance</a> exist, they are only used for imperative actions (such as setting focus on a field), and should generally be avoided.</p>
<p>React takes care of creating an instance for every class component, so you can write components in an object-oriented way with methods and local state, but other than that, instances are not very important in the React’s programming model and are managed by React itself.</p>
<h2><a class="anchor" name="summary"></a>Summary <a class="hash-link" href="#summary">#</a></h2>
<p>An <em>element</em> is a plain object describing what you want to appear on the screen in terms of the DOM nodes or other components. Elements can contain other elements in their props. Creating a React element is cheap. Once an element is created, it is never mutated.</p>
<p>A <em>component</em> can be declared in several different ways. It can be a class with a <code>render()</code> method. Alternatively, in simple cases, it can be defined as a function. In either case, it takes props as an input, and returns an element tree as the output.</p>
<p>When a component receives some props as an input, it is because a particular parent component returned an element with its <code>type</code> and these props. This is why people say that the props flows one way in React: from parents to children.</p>
<p>An <em>instance</em> is what you refer to as <code>this</code> in the component class you write. It is useful for <a href="/react/docs/component-api.html">storing local state and reacting to the lifecycle events</a>.</p>
<p>Functional components don’t have instances at all. Class components have instances, but you never need to create a component instance directly—React takes care of this.</p>
<p>Finally, to create elements, use <a href="/react/docs/top-level-api.html#react.createelement"><code>React.createElement()</code></a>, <a href="/react/docs/jsx-in-depth.html">JSX</a>, or an <a href="/react/docs/top-level-api.html#react.createfactory">element factory helper</a>. Don’t write elements as plain objects in the real code—just know that they are plain objects under the hood.</p>
<h2><a class="anchor" name="further-reading"></a>Further Reading <a class="hash-link" href="#further-reading">#</a></h2>
<ul>
<li><a href="/react/blog/2014/10/14/introducing-react-elements.html">Introducing React Elements</a></li>
<li><a href="/react/blog/2015/02/24/streamlining-react-elements.html">Streamlining React Elements</a></li>
<li><a href="/react/docs/glossary.html">React (Virtual) DOM Terminology</a></li>
</ul>
<div class="footnotes">
<hr>
<ol>
<li id="fn1">
<p>All React elements require an additional <code>$$typeof: Symbol.for(&#39;react.element&#39;)</code> field declared on the object for <a href="https://github.com/facebook/react/pull/4832">security reasons</a>. It is omitted in the examples above. This blog entry uses inline objects for elements to give you an idea of what’s happening underneath but the code won’t run as is unless you either add <code>$$typeof</code> to the elements, or change the code to use <code>React.createElement()</code> or JSX.&nbsp;<a href="#fnref1" rev="footnote">&#8617;</a></p>
</li>
</ol>
</div>
</description>
<pubDate>2015-12-18T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html</guid>
</item>
<item>
<title>isMounted is an Antipattern</title>
<description><p>As we move closer to officially deprecating isMounted, it&#39;s worth understanding why the function is an antipattern, and how to write code without the isMounted function.</p>
<p>The primary use case for <code>isMounted()</code> is to avoid calling <code>setState()</code> after a component has unmounted, because calling <code>setState()</code> after a component has unmounted will emit a warning. The “setState warning” exists to help you catch bugs, because calling <code>setState()</code> on an unmounted component is an indication that your app/component has somehow failed to clean up properly. Specifically, calling <code>setState()</code> in an unmounted component means that your app is still holding a reference to the component after the component has been unmounted - which often indicates a memory leak!</p>
<p>To avoid the error message, people often add lines like this:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">isMounted</span><span class="p">())</span> <span class="p">{</span> <span class="c1">// This is bad.</span>
<span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({...});</span>
<span class="p">}</span>
</code></pre></div>
<p>Checking <code>isMounted</code> before calling <code>setState()</code> does eliminate the warning, but it also defeats the purpose of the warning, since now you will never get the warning (even when you should!)</p>
<p>Other uses of <code>isMounted()</code> are similarly erroneous; using <code>isMounted()</code> is a code smell because the only reason you would check is because you think you might be holding a reference after the component has unmounted.</p>
<p>An easy migration strategy for anyone upgrading their code to avoid <code>isMounted()</code> is to track the mounted status yourself. Just set a <code>_isMounted</code> property to true in <code>componentDidMount</code> and set it to false in <code>componentWillUnmount</code>, and use this variable to check your component&#39;s status.</p>
<p>An optimal solution would be to find places where <code>setState()</code> might be called after a component has unmounted, and fix them. Such situations most commonly occur due to callbacks, when a component is waiting for some data and gets unmounted before the data arrives. Ideally, any callbacks should be canceled in <code>componentWillUnmount</code>, prior to unmounting.</p>
<p>For instance, if you are using a Flux store in your component, you must unsubscribe in <code>componentWillUnmount</code>:</p>
<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="kr">class</span> <span class="nx">MyComponent</span> <span class="kr">extends</span> <span class="nx">React</span><span class="p">.</span><span class="nx">Component</span> <span class="p">{</span>
<span class="nx">componentDidMount</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">mydatastore</span><span class="p">.</span><span class="nx">subscribe</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
<span class="p">}</span>
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="p">...</span>
<span class="p">}</span>
<span class="nx">componentWillUnmount</span><span class="p">()</span> <span class="p">{</span>
<span class="hll"> <span class="nx">mydatastore</span><span class="p">.</span><span class="nx">unsubscribe</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
</span> <span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>If you use ES6 promises, you may need to wrap your promise in order to make it cancelable.</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">const</span> <span class="nx">cancelablePromise</span> <span class="o">=</span> <span class="nx">makeCancelable</span><span class="p">(</span>
<span class="k">new</span> <span class="nx">Promise</span><span class="p">(</span><span class="nx">r</span> <span class="o">=&gt;</span> <span class="nx">component</span><span class="p">.</span><span class="nx">setState</span><span class="p">({...}}))</span>
<span class="p">);</span>
<span class="nx">cancelablePromise</span>
<span class="p">.</span><span class="nx">promise</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;resolved&#39;</span><span class="p">))</span>
<span class="p">.</span><span class="k">catch</span><span class="p">((</span><span class="nx">reason</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;isCanceled&#39;</span><span class="p">,</span> <span class="nx">reason</span><span class="p">.</span><span class="nx">isCanceled</span><span class="p">));</span>
<span class="nx">cancelablePromise</span><span class="p">.</span><span class="nx">cancel</span><span class="p">();</span> <span class="c1">// Cancel the promise</span>
</code></pre></div>
<p>Where <code>makeCancelable</code> is <a href="https://github.com/facebook/react/issues/5465#issuecomment-157888325">defined by @istarkov</a> as:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="kr">const</span> <span class="nx">makeCancelable</span> <span class="o">=</span> <span class="p">(</span><span class="nx">promise</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="kd">let</span> <span class="nx">hasCanceled_</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="k">return</span> <span class="p">{</span>
<span class="nx">promise</span><span class="o">:</span> <span class="k">new</span> <span class="nx">Promise</span><span class="p">(</span>
<span class="p">(</span><span class="nx">resolve</span><span class="p">,</span> <span class="nx">reject</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="nx">promise</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="nx">r</span> <span class="o">=&gt;</span> <span class="nx">hasCanceled_</span>
<span class="o">?</span> <span class="nx">reject</span><span class="p">({</span><span class="nx">isCanceled</span><span class="o">:</span> <span class="kc">true</span><span class="p">})</span>
<span class="o">:</span> <span class="nx">resolve</span><span class="p">(</span><span class="nx">r</span><span class="p">)</span>
<span class="p">)</span>
<span class="p">),</span>
<span class="nx">cancel</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">hasCanceled_</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
<span class="p">},</span>
<span class="p">};</span>
<span class="p">};</span>
</code></pre></div>
<p>As an added bonus for getting your code cleaned up early, getting rid of <code>isMounted()</code> makes it one step easier for you to upgrade to ES6 classes, where using <code>isMounted()</code> is already prohibited. Happy coding!</p>
</description>
<pubDate>2015-12-16T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html</guid>
</item>
<item>
<title>React.js Conf 2016 Diversity Scholarship</title>
<description><p>I am thrilled to announced that we will be organizing another diversity scholarship program for the upcoming React.js Conf! The tech industry is suffering from a lack of diversity, but it&#39;s important to us that we have a thriving community that is made up of people with a variety of experiences and viewpoints.</p>
<p>When we ran this program last year, we had <em>over 200</em> people apply for only 10 tickets. There were so many people that we wanted to bring in but we couldn&#39;t. The results were still awesome, and we had bright individuals from around the world attending who would have otherwise been unable to. These attendees took part in discussions at the conference and brought perspectives that we might not have otherwise seen there.</p>
<p>This year we&#39;re excited to bring back the scholarship, but we&#39;ve set aside <strong>40 tickets</strong> because we really believe that it&#39;s important to do our best to make sure we have an even more diverse audience.</p>
<p>This is something I&#39;m personally really excited to be a part of. I know the rest of the team is as well. We&#39;re really proud to have everyone at Facebook providing support and funding for this.</p>
<p>The details of the scholarship are provided below (or you can <a href="http://goo.gl/forms/PEmKj8oUp4">go directly to the application</a>). I encourage you to apply! If you don&#39;t feel like you are eligible yourself, you can still help – send this along to friends, family, coworkers, acquaintances, or anybody who might be interested. And even if you haven&#39;t spoken before, please consider <a href="http://conf.reactjs.com/">submitting a proposal for a talk</a> (either 30 minutes or just 5 minutes) - we&#39;re hoping to have a very diverse group of speakers in addition to attendees.</p>
<hr>
<p>Facebook is excited to announce that we are now accepting applications for the React.js Conf Diversity Scholarship!</p>
<p>Beginning today, those studying or working in computer science or a related field can apply for a partial scholarship to attend the React.js Conf in San Francisco, CA on February 22 &amp; 23, 2016.</p>
<p>React opens a world of new possibilities such as server-side rendering, real-time updates, different rendering targets like SVG and canvas. React Native makes is easy to use the same concepts and technologies to build native mobile experiences on iOS and Android. Join us at React.js Conf to shape the future of client-side applications! For more information about the React.js conference, please see <a href="http://conf.reactjs.com/">the website</a>.</p>
<p>At Facebook, we believe that anyone anywhere can make a positive impact by developing products to make the world more open and connected to the people and things they care about. Given the current realities of the tech industry and the lack of representation of communities we seek to serve, applicants currently under-represented in Computer Science and related fields are strongly encouraged to apply. Facebook will make determinations on scholarship recipients in its sole discretion. Facebook complies with all equal opportunity laws.</p>
<p>To apply for the scholarship, please visit the application page: <strong><a href="http://goo.gl/forms/PEmKj8oUp4">http://goo.gl/forms/PEmKj8oUp4</a></strong></p>
<h2><a class="anchor" name="award-includes"></a>Award Includes <a class="hash-link" href="#award-includes">#</a></h2>
<ul>
<li>Paid registration fee for the React.js Conf Feburary 22 &amp; 23 in downtown San Francisco, CA</li>
<li>Paid lodging expenses for February 21, 22, 23</li>
</ul>
<h2><a class="anchor" name="important-dates"></a>Important Dates <a class="hash-link" href="#important-dates">#</a></h2>
<ul>
<li>Sunday December 13th 2015 - 11:59 PST: Applications for the React.js Conf Scholarship must be submitted in full</li>
<li>Wednesday, December 16th, 2015: Award recipients will be notified by email of their acceptance</li>
<li>Monday &amp; Tuesday, February 22 &amp; 23, 2016: React.js Conf</li>
</ul>
<h2><a class="anchor" name="eligibility"></a>Eligibility <a class="hash-link" href="#eligibility">#</a></h2>
<ul>
<li>Must currently be studying or working in Computer Science or a related field</li>
<li>International applicants are welcome, but you will be responsible for securing your own visa to attend the conference</li>
<li>You must be able to provide your own transportation to San Francisco</li>
<li>You must be available to attend the full duration of React.js Conf on February 22 &amp; 23 in San Francisco, CA</li>
</ul>
</description>
<pubDate>2015-12-04T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/04/react-js-conf-2016-diversity-scholarship.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/04/react-js-conf-2016-diversity-scholarship.html</guid>
</item>
<item>
<title>React v0.14.3</title>
<description><p>It&#39;s time for another installment of React patch releases! We didn&#39;t break anything in v0.14.2 but we do have a couple of other bugs we&#39;re fixing. The biggest change in this release is actually an addition of a new built file. We heard from a number of people that they still need the ability to use React to render to a string on the client. While the use cases are not common and there are other ways to achieve this, we decided that it&#39;s still valuable to support. So we&#39;re now building <code>react-dom-server.js</code>, which will be shipped to Bower and in the <code>dist/</code> directory of the <code>react-dom</code> package on npm. This file works the same way as <code>react-dom.js</code> and therefore requires that the primary React build has already been included on the page.</p>
<p>The release is now available for download:</p>
<ul>
<li><strong>React</strong><br>
Dev build with warnings: <a href="https://fb.me/react-0.14.3.js">https://fb.me/react-0.14.3.js</a><br>
Minified build for production: <a href="https://fb.me/react-0.14.3.min.js">https://fb.me/react-0.14.3.min.js</a><br></li>
<li><strong>React with Add-Ons</strong><br>
Dev build with warnings: <a href="https://fb.me/react-with-addons-0.14.3.js">https://fb.me/react-with-addons-0.14.3.js</a><br>
Minified build for production: <a href="https://fb.me/react-with-addons-0.14.3.min.js">https://fb.me/react-with-addons-0.14.3.min.js</a><br></li>
<li><strong>React DOM</strong> (include React in the page before React DOM)<br>
Dev build with warnings: <a href="https://fb.me/react-dom-0.14.3.js">https://fb.me/react-dom-0.14.3.js</a><br>
Minified build for production: <a href="https://fb.me/react-dom-0.14.3.min.js">https://fb.me/react-dom-0.14.3.min.js</a><br></li>
<li><strong>React DOM Server</strong> (include React in the page before React DOM Server)<br>
Dev build with warnings: <a href="https://fb.me/react-dom-server-0.14.3.js">https://fb.me/react-dom-server-0.14.3.js</a><br>
Minified build for production: <a href="https://fb.me/react-dom-server-0.14.3.min.js">https://fb.me/react-dom-server-0.14.3.min.js</a><br></li>
</ul>
<p>We&#39;ve also published version <code>0.14.3</code> of the <code>react</code>, <code>react-dom</code>, and addons packages on npm and the <code>react</code> package on bower.</p>
<hr>
<h2><a class="anchor" name="changelog"></a>Changelog <a class="hash-link" href="#changelog">#</a></h2><h3><a class="anchor" name="react-dom"></a>React DOM <a class="hash-link" href="#react-dom">#</a></h3>
<ul>
<li>Added support for <code>nonce</code> attribute for <code>&lt;script&gt;</code> and <code>&lt;style&gt;</code> elements</li>
<li>Added support for <code>reversed</code> attribute for <code>&lt;ol&gt;</code> elements</li>
</ul>
<h3><a class="anchor" name="react-testutils-add-on"></a>React TestUtils Add-on <a class="hash-link" href="#react-testutils-add-on">#</a></h3>
<ul>
<li>Fixed bug with shallow rendering and function refs</li>
</ul>
<h3><a class="anchor" name="react-csstransitiongroup-add-on"></a>React CSSTransitionGroup Add-on <a class="hash-link" href="#react-csstransitiongroup-add-on">#</a></h3>
<ul>
<li>Fixed bug resulting in timeouts firing incorrectly when mounting and unmounting rapidly</li>
</ul>
<h3><a class="anchor" name="react-on-bower"></a>React on Bower <a class="hash-link" href="#react-on-bower">#</a></h3>
<ul>
<li>Added <code>react-dom-server.js</code> to expose <code>renderToString</code> and <code>renderToStaticMarkup</code> for usage in the browser</li>
</ul>
</description>
<pubDate>2015-11-18T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/11/18/react-v0.14.3.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/11/18/react-v0.14.3.html</guid>
</item>
<item>
<title>React v0.14.2</title>
<description><p>We have a quick update following the release of 0.14.1 last week. It turns out we broke a couple things in the development build of React when using Internet Explorer. Luckily it was only the development build, so your production applications were unaffected. This release is mostly to address those issues. There is one notable change if consuming React from npm. For the <code>react-dom</code> package, we moved <code>react</code> from a regular dependency to a peer dependency. This will impact very few people as these two are typically installed together at the top level, but it will fix some issues with dependencies of installed components also using <code>react</code> as a peer dependency.</p>
<p>The release is now available for download:</p>
<ul>
<li><strong>React</strong><br>
Dev build with warnings: <a href="https://fb.me/react-0.14.2.js">https://fb.me/react-0.14.2.js</a><br>
Minified build for production: <a href="https://fb.me/react-0.14.2.min.js">https://fb.me/react-0.14.2.min.js</a><br></li>
<li><strong>React with Add-Ons</strong><br>
Dev build with warnings: <a href="https://fb.me/react-with-addons-0.14.2.js">https://fb.me/react-with-addons-0.14.2.js</a><br>
Minified build for production: <a href="https://fb.me/react-with-addons-0.14.2.min.js">https://fb.me/react-with-addons-0.14.2.min.js</a><br></li>
<li><strong>React DOM</strong> (include React in the page before React DOM)<br>
Dev build with warnings: <a href="https://fb.me/react-dom-0.14.2.js">https://fb.me/react-dom-0.14.2.js</a><br>
Minified build for production: <a href="https://fb.me/react-dom-0.14.2.min.js">https://fb.me/react-dom-0.14.2.min.js</a><br></li>
</ul>
<p>We&#39;ve also published version <code>0.14.2</code> of the <code>react</code>, <code>react-dom</code>, and addons packages on npm and the <code>react</code> package on bower.</p>
<hr>
<h2><a class="anchor" name="changelog"></a>Changelog <a class="hash-link" href="#changelog">#</a></h2><h3><a class="anchor" name="react-dom"></a>React DOM <a class="hash-link" href="#react-dom">#</a></h3>
<ul>
<li>Fixed bug with development build preventing events from firing in some versions of Internet Explorer &amp; Edge</li>
<li>Fixed bug with development build when using es5-sham in older versions of Internet Explorer</li>
<li>Added support for <code>integrity</code> attribute</li>
<li>Fixed bug resulting in <code>children</code> prop being coerced to a string for custom elements, which was not the desired behavior.</li>
<li>Moved <code>react</code> from <code>dependencies</code> to <code>peerDependencies</code> to match expectations and align with <code>react-addons-*</code> packages</li>
</ul>
</description>
<pubDate>2015-11-02T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/11/02/react-v0.14.2.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/11/02/react-v0.14.2.html</guid>
</item>
<item>
<title>React v0.14.1</title>
<description><p>After a couple weeks of having more people use v0.14, we&#39;re ready to ship a patch release addressing a few issues. Thanks to everybody who has reported issues and written patches!</p>
<p>The release is now available for download:</p>
<ul>
<li><strong>React</strong><br>
Dev build with warnings: <a href="https://fb.me/react-0.14.1.js">https://fb.me/react-0.14.1.js</a><br>
Minified build for production: <a href="https://fb.me/react-0.14.1.min.js">https://fb.me/react-0.14.1.min.js</a><br></li>
<li><strong>React with Add-Ons</strong><br>
Dev build with warnings: <a href="https://fb.me/react-with-addons-0.14.1.js">https://fb.me/react-with-addons-0.14.1.js</a><br>
Minified build for production: <a href="https://fb.me/react-with-addons-0.14.1.min.js">https://fb.me/react-with-addons-0.14.1.min.js</a><br></li>
<li><strong>React DOM</strong> (include React in the page before React DOM)<br>
Dev build with warnings: <a href="https://fb.me/react-dom-0.14.1.js">https://fb.me/react-dom-0.14.1.js</a><br>
Minified build for production: <a href="https://fb.me/react-dom-0.14.1.min.js">https://fb.me/react-dom-0.14.1.min.js</a><br></li>
</ul>
<p>We&#39;ve also published version <code>0.14.1</code> of the <code>react</code>, <code>react-dom</code>, and addons packages on npm and the <code>react</code> package on bower.</p>
<hr>
<h2><a class="anchor" name="changelog"></a>Changelog <a class="hash-link" href="#changelog">#</a></h2><h3><a class="anchor" name="react-dom"></a>React DOM <a class="hash-link" href="#react-dom">#</a></h3>
<ul>
<li>Fixed bug where events wouldn&#39;t fire in old browsers when using React in development mode</li>
<li>Fixed bug preventing use of <code>dangerouslySetInnerHTML</code> with Closure Compiler Advanced mode</li>
<li>Added support for <code>srcLang</code>, <code>default</code>, and <code>kind</code> attributes for <code>&lt;track&gt;</code> elements</li>
<li>Added support for <code>color</code> attribute</li>
<li>Ensured legacy <code>.props</code> access on DOM nodes is updated on re-renders</li>
</ul>
<h3><a class="anchor" name="react-testutils-add-on"></a>React TestUtils Add-on <a class="hash-link" href="#react-testutils-add-on">#</a></h3>
<ul>
<li>Fixed <code>scryRenderedDOMComponentsWithClass</code> so it works with SVG</li>
</ul>
<h3><a class="anchor" name="react-csstransitiongroup-add-on"></a>React CSSTransitionGroup Add-on <a class="hash-link" href="#react-csstransitiongroup-add-on">#</a></h3>
<ul>
<li>Fix bug preventing <code>0</code> to be used as a timeout value</li>
</ul>
<h3><a class="anchor" name="react-on-bower"></a>React on Bower <a class="hash-link" href="#react-on-bower">#</a></h3>
<ul>
<li>Added <code>react-dom.js</code> to <code>main</code> to improve compatibility with tooling</li>
</ul>
</description>
<pubDate>2015-10-28T00:00:00-07:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/10/28/react-v0.14.1.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/10/28/react-v0.14.1.html</guid>
</item>
<item>
<title>Reactiflux is moving to Discord</title>
<description><p>TL;DR: Slack decided that Reactiflux had too many members and disabled new invites. Reactiflux is moving to Discord. Join us: <a href="http://join.reactiflux.com/">http://join.reactiflux.com</a></p>
<h2><a class="anchor" name="what-happened-with-slack"></a>What happened with Slack? <a class="hash-link" href="#what-happened-with-slack">#</a></h2>
<p>A few weeks ago, Reactiflux reached 7,500 members on Slack. Shortly after, Slack decided we were too big and disabled invites. There was no way for new users to join. Many of us were sad and upset. We loved Slack. Our community was built around it.</p>
<p>We reached out to Slack several times, but their decision was firm. Our large community caused performance issues. Slack wants to focus on building a great product for teams, not necessarily large open communities. Losing focus and building for too many use cases always leads to product bloat, and eventually a decrease in quality.</p>
<h2><a class="anchor" name="so-why-discord"></a>So… why Discord? <a class="hash-link" href="#so-why-discord">#</a></h2>
<p>After a <a href="https://github.com/reactiflux/volunteers/issues/25">long and thorough debate</a>, Discord quickly emerged as the most promising service. After just a few days, 400 members had joined the Discord server, and many already loved it.</p>
<h3><a class="anchor" name="easiest-to-join"></a>Easiest to join <a class="hash-link" href="#easiest-to-join">#</a></h3>
<p>Discord is the easiest platform to join. New users can immediately join our conversations without having to create an account. All they need to do is provide a name. No permission granting, no password, no email confirmation.</p>
<p>This is critically useful for us, and will make Reactiflux even more open and accessible.</p>
<h3><a class="anchor" name="great-apps"></a>Great apps <a class="hash-link" href="#great-apps">#</a></h3>
<p>Out of all of the services we’ve tried, Discord’s apps are by far the most polished. They are well designed, easy to use, and surprisingly fast. In addition to the web app, they have mobile apps on both iOS and Android as well as desktop apps for OS X and Windows, with Linux support coming soon.</p>
<p>Their desktop apps are built with React and Electron, and their iOS app is built with React Native.</p>
<h3><a class="anchor" name="moderation-tools"></a>Moderation tools <a class="hash-link" href="#moderation-tools">#</a></h3>
<p>So far, we’ve been fortunate not to have to deal with spammers and trolls. As our community continues to grow, that might change. Unsurprisingly, Discord is the only app we’ve seen with legitimate moderation tools. It was built for gaming communities, after all.</p>
<h3><a class="anchor" name="great-multiple-server-support"></a>Great multiple Server support <a class="hash-link" href="#great-multiple-server-support">#</a></h3>
<p>Your Discord account works with every Discord server, which is the equivalent of a Slack team. You don’t need to create a new account every time you join a new team. You can join new servers in one click, and it’s very easy to switch between them. Discord messages also work across servers, so your personal conversations are not scoped to a single server.</p>
<p>Instead of having one huge, crowded Reactiflux server, we can branch off closely related channels into sub-servers. Communities will start overlapping, and it will be easy to interact with non-Reactiflux channels.</p>
<h3><a class="anchor" name="its-hosted"></a>It’s hosted <a class="hash-link" href="#its-hosted">#</a></h3>
<p>Self-hosted apps require maintenance. We’re all busy, and we can barely find the time to keep our landing page up to date and running smoothly. More than anything, we need a stable platform, and we don’t have the resources to guarantee that right now.</p>
<p>It’s a much safer bet to offload the hosting to Discord, who is already keeping the lights on for all their users.</p>
<h3><a class="anchor" name="we-like-the-team"></a>We like the team <a class="hash-link" href="#we-like-the-team">#</a></h3>
<p>And they seem to like us back. They are excited for us to join them, and they’ve been very responsive to our feedback and suggestions.</p>
<p>They implemented code syntax highlighting just a few days after we told them we needed it.</p>
<p>Discord’s team has already built a solid suite of apps, and they have shown us how much they care about their users. We’re excited to see how they will continue to improve their product.</p>
<h2><a class="anchor" name="and-whats-the-catch"></a>And what’s the catch? <a class="hash-link" href="#and-whats-the-catch">#</a></h2>
<p>Choosing the best chat service is subjective. There are a million reasons why Discord <em>might be</em> a terrible idea. Here are the ones that we’re most worried about:</p>
<h3><a class="anchor" name="difficult-channel-management"></a>Difficult channel management <a class="hash-link" href="#difficult-channel-management">#</a></h3>
<p>Channel management seems to be the biggest issue. There is no way to opt out of channels; you can only mute them. And you can only mute channels one by one. There is no way to star channels, and channels can only be sorted on the server level. Each user will see the list of channels in the same order.</p>
<p>As the number of channels grow, it will be challenging to keep things in order. Branching off sub-servers will help, and we will keep an easily accessible directory of channels across our main server and all of the sub-servers.</p>
<p>We can build simple tools to make channel lookup easier, and the Discord team is working on improvements that should make this more manageable.</p>
<h3><a class="anchor" name="no-search"></a>No Search <a class="hash-link" href="#no-search">#</a></h3>
<p>Lack of search is clearly a bummer, but Discord is working on it. Search is coming!</p>
<h3><a class="anchor" name="firewall"></a>Firewall <a class="hash-link" href="#firewall">#</a></h3>
<p>A couple of users aren’t able to access Discord at work since other corporate filters classify it as a gaming application. This sucks, but it seems to be a rare case. So far, it seems only to affect 0.6% of our current community (3/500).</p>
<p>We hope that these users can get Discord&#39;s domains whitelisted, and we’ll try to find a solution if this is a widespread issue. The Discord team is aware of the issue as well.</p>
<h2><a class="anchor" name="is-discord-going-to-disappear-tomorrow"></a>Is Discord going to disappear tomorrow? <a class="hash-link" href="#is-discord-going-to-disappear-tomorrow">#</a></h2>
<p>Probably not tomorrow. They have 14 people <a href="https://discordapp.com/company">full time</a>, and they’ve raised money from some of the best investors in Silicon Valley, including <a href="http://www.benchmark.com/">Benchmark</a> and <a href="http://www.accel.com/companies/">Accel</a>.</p>
<p>By focusing on gaming communities, Discord has differentiated itself from the many other communication apps. Discord is well received and has a rapidly growing user base. They plan to keep their basic offerings free for unlimited users and hope to make money with premium offerings (themes, add-ons, content, and more).</p>
<h2><a class="anchor" name="join-us"></a>Join us! <a class="hash-link" href="#join-us">#</a></h2>
<p>More than 500 of us have already migrated to the new Reactiflux. Join us, we&#39;re one click away: <a href="http://join.reactiflux.com/">http://join.reactiflux.com</a></p>
<p><em>Note: Jordan Hawker’s thorough <a href="http://jhawk.co/team-chat-comparison">research</a> made our decision a lot easier.</em></p>
</description>
<pubDate>2015-10-19T00:00:00-07:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/10/19/reactiflux-is-moving-to-discord.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/10/19/reactiflux-is-moving-to-discord.html</guid>
</item>
</channel>
</rss>