Browse Source

Merge branch 'master' of https://github.com/reactjs/reactjs.org into defer-babel-loading

main
renanpvaz 7 years ago
parent
commit
b843de780d
  1. 393
      LICENSE-DOCS.md
  2. 414
      LICENSE.md
  3. 12
      README.md
  4. 4
      content/blog/2015-01-27-react-v0.13.0-beta-1.md
  5. 4
      content/blog/2017-07-26-error-handling-in-react-16.md
  6. 2
      content/docs/codebase-overview.md
  7. 137
      content/docs/error-boundaries.md
  8. 15
      content/docs/forms.md
  9. 4
      content/docs/higher-order-components.md
  10. 6
      content/docs/installation.md
  11. 2
      content/docs/nav.yml
  12. 2
      content/docs/reference-react-component.md
  13. 4
      content/docs/thinking-in-react.md
  14. 0
      content/images/docs/error-boundaries-stack-trace-line-numbers.png
  15. 0
      content/images/docs/error-boundaries-stack-trace.png
  16. 2
      content/tutorial/nav.yml
  17. 36
      content/tutorial/tutorial.md
  18. 20
      gatsby-node.js
  19. 21
      src/components/CodeEditor/CodeEditor.js
  20. 2
      src/components/CodeEditor/index.js
  21. 2
      src/components/Container/index.js
  22. 2
      src/components/ErrorDecoder/ErrorDecoder.js
  23. 2
      src/components/ErrorDecoder/index.js
  24. 2
      src/components/Flex/Flex.js
  25. 2
      src/components/Flex/index.js
  26. 2
      src/components/Header/Header.js
  27. 2
      src/components/Header/index.js
  28. 2
      src/components/LayoutFooter/ExternalFooterLink.js
  29. 2
      src/components/LayoutFooter/Footer.js
  30. 2
      src/components/LayoutFooter/FooterLink.js
  31. 2
      src/components/LayoutFooter/FooterNav.js
  32. 2
      src/components/LayoutFooter/index.js
  33. 2
      src/components/LayoutHeader/Header.js
  34. 2
      src/components/LayoutHeader/HeaderLink.js
  35. 2
      src/components/LayoutHeader/SearchSvg.js
  36. 2
      src/components/LayoutHeader/index.js
  37. 2
      src/components/MarkdownHeader/MarkdownHeader.js
  38. 2
      src/components/MarkdownHeader/index.js
  39. 7
      src/components/MarkdownPage/MarkdownPage.js
  40. 2
      src/components/MarkdownPage/index.js
  41. 2
      src/components/StickyResponsiveSidebar/StickyResponsiveSidebar.js
  42. 2
      src/components/StickyResponsiveSidebar/index.js
  43. 2
      src/components/TitleAndMetaTags/TitleAndMetaTags.js
  44. 2
      src/components/TitleAndMetaTags/index.js
  45. 10
      src/css/algolia.css
  46. 2
      src/layouts/index.js
  47. 2
      src/pages/acknowledgements.html.js
  48. 2
      src/pages/docs/error-decoder.html.js
  49. 2
      src/templates/blog.js
  50. 2
      src/templates/community.js
  51. 2
      src/templates/components/ButtonLink/ButtonLink.js
  52. 2
      src/templates/components/ButtonLink/index.js
  53. 2
      src/templates/components/ChevronSvg/index.js
  54. 2
      src/templates/components/ExternalLinkSvg/index.js
  55. 2
      src/templates/components/MetaTitle/index.js
  56. 2
      src/templates/components/NavigationFooter/NavigationFooter.js
  57. 2
      src/templates/components/NavigationFooter/index.js
  58. 103
      src/templates/components/Sidebar/ScrollSyncSection.js
  59. 13
      src/templates/components/Sidebar/Section.js
  60. 13
      src/templates/components/Sidebar/Sidebar.js
  61. 2
      src/templates/components/Sidebar/index.js
  62. 2
      src/templates/docs.js
  63. 2
      src/templates/home.js
  64. 3
      src/templates/tutorial.js
  65. 27
      src/utils/createLink.js
  66. 2
      src/utils/findSectionForPath.js
  67. 2
      src/utils/isItemActive.js
  68. 2
      src/utils/mountCodeExample.js
  69. 10
      src/utils/sectionList.js
  70. 2
      src/utils/slugify.js
  71. 2
      src/utils/toCommaSeparatedList.js
  72. 2
      static/_redirects
  73. 21
      static/html/single-file-example.html

393
LICENSE-DOCS.md

@ -0,0 +1,393 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.

414
LICENSE.md

@ -1,393 +1,21 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.
MIT License
Copyright (c) 2013-present, Facebook, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12
README.md

@ -8,8 +8,8 @@ This repo contains the source code and documentation powering [reactjs.org](http
1. Git
1. Node: install version 8.4 or greater
1. Yarn: `npm i -g yarn` to install it globally via NPM
1. A clone of the [reactjs.org repo](https://github.com/facebook/reactjs.org) on your local machine
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
1. A clone of the [reactjs.org repo](https://github.com/reactjs/reactjs.org) on your local machine
1. A fork of the repo (for any contributions)
### Installation
@ -26,7 +26,7 @@ This repo contains the source code and documentation powering [reactjs.org](http
### Create a branch
1. `git checkout master` from any folder in your local react repository
1. `git checkout master` from any folder in your local `reactjs.org` repository
1. `git pull origin master` to ensure you have the latest main code
1. `git checkout -b the-name-of-my-branch` (replacing `the-name-of-my-branch` with a suitable name) to create a branch
@ -41,16 +41,16 @@ This repo contains the source code and documentation powering [reactjs.org](http
### Test the change
1. If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
1. Run `yarn check-all` from the project root. (This will run Prettier, ESlint, and Flow.)
1. Run `yarn check-all` from the project root. (This will run Prettier, ESLint, and Flow.)
### Push it
1. `git add -A && git commit -m "My message"` (replacing `My message` with a commit message, such as `Fixed header logo on Android`) to stage and commit your changes
1. `git push my-fork-name the-name-of-my-branch`
1. Go to the [reactjs.org repo](https://github.com/facebook/reactjs.org) and you should see recently pushed branches.
1. Go to the [reactjs.org repo](https://github.com/reactjs/reactjs.org) and you should see recently pushed branches.
1. Follow GitHub's instructions.
1. If possible include screenshots of visual changes. A Netlify build will also be automatically created once you make your PR so other people can see your change.
## Troubleshooting
- `yarn reset` to clear the local cache
- `yarn reset` to clear the local cache

4
content/blog/2015-01-27-react-v0.13.0-beta-1.md

@ -89,8 +89,8 @@ Therefore we decided not to have this built-in into React's class model. You can
```javascript
class Counter extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.tick = this.tick.bind(this);
}
tick() {

4
content/blog/2017-07-26-error-handling-in-react-16.md

@ -79,11 +79,11 @@ We also encourage you to use JS error reporting services (or build your own) so
React 16 prints all errors that occurred during rendering to the console in development, even if the application accidentally swallows them. In addition to the error message and the JavaScript stack, it also provides component stack traces. Now you can see where exactly in the component tree the failure has happened:
<img src="../images/blog/error-boundaries-stack-trace.png" alt="Component stack traces in error message" style="width: 100%;">
<img src="../images/docs/error-boundaries-stack-trace.png" alt="Component stack traces in error message" style="width: 100%;">
You can also see the filenames and line numbers in the component stack trace. This works by default in [Create React App](https://github.com/facebookincubator/create-react-app) projects:
<img src="../images/blog/error-boundaries-stack-trace-line-numbers.png" alt="Component stack traces with line numbers in error message" style="width: 100%;">
<img src="../images/docs/error-boundaries-stack-trace-line-numbers.png" alt="Component stack traces with line numbers in error message" style="width: 100%;">
If you don’t use Create React App, you can add [this plugin](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source) manually to your Babel configuration. Note that it’s intended only for development and **must be disabled in production**.

2
content/docs/codebase-overview.md

@ -66,7 +66,7 @@ The [fbjs repository](https://github.com/facebook/fbjs) exists because React sha
After cloning the [React repository](https://github.com/facebook/react), you will see a few top-level folders in it:
* [`src`](https://github.com/facebook/react/tree/master/src) is the source code of React. **If your change is related to the code, `src` is where you'll spend most of your time.**
* [`docs`](https://github.com/facebook/react/tree/master/docs) is the React documentation website. When you change APIs, make sure to update the relevant Markdown files.
* [`docs`](https://github.com/reactjs/reactjs.org/tree/master/content) is the React documentation website. When you change APIs, make sure to update the relevant Markdown files.
* [`fixtures`](https://github.com/facebook/react/tree/master/fixtures) contains a few small React test applications for contributors.
* [`packages`](https://github.com/facebook/react/tree/master/packages) contains metadata (such as `package.json`) for all packages in the React repository. Nevertheless, their source code is still located inside [`src`](https://github.com/facebook/react/tree/master/src).
* `build` is the build output of React. It is not in the repository but it will appear in your React clone after you [build it](/docs/how-to-contribute.html#development-workflow) for the first time.

137
content/docs/error-boundaries.md

@ -0,0 +1,137 @@
---
id: error-boundaries
title: Error Boundaries
permalink: docs/error-boundaries.html
---
In the past, JavaScript errors inside components used to corrupt React’s internal state and cause it to [emit](https://github.com/facebook/react/issues/4026) [cryptic](https://github.com/facebook/react/issues/6895) [errors](https://github.com/facebook/react/issues/8579) on next renders. These errors were always caused by an earlier error in the application code, but React did not provide a way to handle them gracefully in components, and could not recover from them.
## Introducing Error Boundaries
A JavaScript error in a part of the UI shouldn’t break the whole app. To solve this problem for React users, React 16 introduces a new concept of an “error boundary”.
Error boundaries are React components that **catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI** instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
A class component becomes an error boundary if it defines a new lifecycle method called `componentDidCatch(error, info)`:
```js{7-12,15-18}
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
// Display fallback UI
this.setState({ hasError: true });
// You can also log the error to an error reporting service
logErrorToMyService(error, info);
}
render() {
if (this.state.hasError) {
// You can render any custom fallback UI
return <h1>Something went wrong.</h1>;
}
return this.props.children;
}
}
```
Then you can use it as a regular component:
```js
<ErrorBoundary>
<MyWidget />
</ErrorBoundary>
```
The `componentDidCatch()` method works like a JavaScript `catch {}` block, but for components. Only class components can be error boundaries. In practice, most of the time you’ll want to declare an error boundary component once and use it throughout your application.
Note that **error boundaries only catch errors in the components below them in the tree**. An error boundary can’t catch an error within itself. If an error boundary fails trying to render the error message, the error will propagate to the closest error boundary above it. This, too, is similar to how catch {} block works in JavaScript.
### componentDidCatch Parameters
`error` is an error that has been thrown.
`info` is an object with `componentStack` key. The property has information about component stack during thrown error.
```js
//...
componentDidCatch(error, info) {
/* Example stack information:
in ComponentThatThrows (created by App)
in ErrorBoundary (created by App)
in div (created by App)
in App
*/
logComponentStackToMyService(info.componentStack);
}
//...
```
## Live Demo
Check out [this example of declaring and using an error boundary](https://codepen.io/gaearon/pen/wqvxGa?editors=0010) with [React 16 beta](https://github.com/facebook/react/issues/10294).
## Where to Place Error Boundaries
The granularity of error boundaries is up to you. You may wrap top-level route components to display a “Something went wrong” message to the user, just like server-side frameworks often handle crashes. You may also wrap individual widgets in an error boundary to protect them from crashing the rest of the application.
## New Behavior for Uncaught Errors
This change has an important implication. **As of React 16, errors that were not caught by any error boundary will result in unmounting of the whole React component tree.**
We debated this decision, but in our experience it is worse to leave corrupted UI in place than to completely remove it. For example, in a product like Messenger leaving the broken UI visible could lead to somebody sending a message to the wrong person. Similarly, it is worse for a payments app to display a wrong amount than to render nothing.
This change means that as you migrate to React 16, you will likely uncover existing crashes in your application that have been unnoticed before. Adding error boundaries lets you provide better user experience when something goes wrong.
For example, Facebook Messenger wraps content of the sidebar, the info panel, the conversation log, and the message input into separate error boundaries. If some component in one of these UI areas crashes, the rest of them remain interactive.
We also encourage you to use JS error reporting services (or build your own) so that you can learn about unhandled exceptions as they happen in production, and fix them.
## Component Stack Traces
React 16 prints all errors that occurred during rendering to the console in development, even if the application accidentally swallows them. In addition to the error message and the JavaScript stack, it also provides component stack traces. Now you can see where exactly in the component tree the failure has happened:
<img src="../images/docs/error-boundaries-stack-trace.png" style="max-width:100%" alt="Error caught by Error Boundary component">
You can also see the filenames and line numbers in the component stack trace. This works by default in [Create React App](https://github.com/facebookincubator/create-react-app) projects:
<img src="../images/docs/error-boundaries-stack-trace-line-numbers.png" style="max-width:100%" alt="Error caught by Error Boundary component with line numbers">
If you don’t use Create React App, you can add [this plugin](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source) manually to your Babel configuration. Note that it’s intended only for development and **must be disabled in production**.
## Why Not Use try/catch?
`try` / `catch` is great but it only works for imperative code:
```js
try {
showButton();
} catch (error) {
// ...
}
```
However, React components are declarative and specify *what* should be rendered:
```js
<Button />
```
Error boundaries preserve the declarative nature of React, and behave as you would expect. For example, even if an error occurs in a `componentDidUpdate` hook caused by a `setState` somewhere deep in the tree, it will still correctly propagate to the closest error boundary.
## Naming Changes from React 15
React 15 included a very limited support for error boundaries under a different method name: `unstable_handleError`. This method no longer works, and you will need to change it to `componentDidCatch` in your code starting from the first 16 beta release.
For this change, we’ve provided a [codemod](https://github.com/reactjs/react-codemod#error-boundaries) to automatically migrate your code.

15
content/docs/forms.md

@ -264,6 +264,21 @@ this.setState(partialState);
Also, since `setState()` automatically [merges a partial state into the current state](/docs/state-and-lifecycle.html#state-updates-are-merged), we only needed to call it with the changed parts.
## Controlled Input Null Value
Specifying the value prop on a [controlled component](/docs/forms.html#controlled-components) prevents the user from changing the input unless you desire so. If you've specified a `value` but the input is still editable, you may have accidentally set `value` to `undefined` or `null`.
The following code demonstrates this. (The input is locked at first but becomes editable after a short delay.)
```javascript
ReactDOM.render(<input value="hi" />, mountNode);
setTimeout(function() {
ReactDOM.render(<input value={null} />, mountNode);
}, 1000);
```
## Alternatives to Controlled Components
It can sometimes be tedious to use controlled components, because you need to write an event handler for every way your data can change and pipe all of the input state through a React component. This can become particularly annoying when you are converting a preexisting codebase to React, or integrating a React application with a non-React library. In these situations, you might want to check out [uncontrolled components](/docs/uncontrolled-components.html), an alternative technique for implementing input forms.

4
content/docs/higher-order-components.md

@ -30,8 +30,8 @@ For example, say you have a `CommentList` component that subscribes to an extern
```js
class CommentList extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.state = {
// "DataSource" is some global data source

6
content/docs/installation.md

@ -24,13 +24,13 @@ Here are a couple of ways to get started:
If you're just interested in playing around with React, you can use CodePen. Try starting from [this Hello World example code](http://codepen.io/gaearon/pen/rrpgNB?editors=0010). You don't need to install anything; you can just modify the code and see if it works.
If you prefer to use your own text editor, you can also <a href="https://raw.githubusercontent.com/facebook/react/master/docs/downloads/single-file-example.html" download="hello.html">download this HTML file</a>, edit it, and open it from the local filesystem in your browser. It does a slow runtime code transformation, so don't use it in production.
If you prefer to use your own text editor, you can also <a href="https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html" download="hello.html">download this HTML file</a>, edit it, and open it from the local filesystem in your browser. It does a slow runtime code transformation, so don't use it in production.
If you want to use it for a full application, there are two popular ways to get started with React: using Create React App, or adding it to an existing application.
## Creating a New Application
[Create React App](http://github.com/facebookincubator/create-react-app) is the best way to start building a new React single page application. It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production.
[Create React App](http://github.com/facebookincubator/create-react-app) is the best way to start building a new React single page application. It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production. You’ll need to have Node >= 6 on your machine.
```bash
npm install -g create-react-app
@ -84,7 +84,7 @@ Both Yarn and npm download packages from the [npm registry](http://npmjs.com/).
We recommend using React with [Babel](http://babeljs.io/) to let you use ES6 and JSX in your JavaScript code. ES6 is a set of modern JavaScript features that make development easier, and JSX is an extension to the JavaScript language that works nicely with React.
The [Babel setup instructions](https://babeljs.io/docs/setup/) explain how to configure Babel in many different build environments. Make sure you install [`babel-preset-react`](http://babeljs.io/docs/plugins/preset-react/#basic-setup-with-the-cli-) and [`babel-preset-es2015`](http://babeljs.io/docs/plugins/preset-es2015/#basic-setup-with-the-cli-) and enable them in your [`.babelrc` configuration](http://babeljs.io/docs/usage/babelrc/), and you're good to go.
The [Babel setup instructions](https://babeljs.io/docs/setup/) explain how to configure Babel in many different build environments. Make sure you install [`babel-preset-react`](http://babeljs.io/docs/plugins/preset-react/#basic-setup-with-the-cli-) and [`babel-preset-env`](http://babeljs.io/docs/plugins/preset-env/) and enable them in your [`.babelrc` configuration](http://babeljs.io/docs/usage/babelrc/), and you're good to go.
### Hello World with ES6 and JSX

2
content/docs/nav.yml

@ -48,6 +48,8 @@
title: Context
- id: portals
title: Portals
- id: error-boundaries
title: Error Boundaries
- id: web-components
title: Web Components
- id: higher-order-components

2
content/docs/reference-react-component.md

@ -216,7 +216,7 @@ componentWillUpdate(nextProps, nextState)
`componentWillUpdate()` is invoked immediately before rendering when new props or state are being received. Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render.
Note that you cannot call `this.setState()` here. If you need to update state in response to a prop change, use `componentWillReceiveProps()` instead.
Note that you cannot call `this.setState()` here; nor should you do anything else (eg dispatch a redux action) that would trigger an update to a React component before `componentWillUpdate` returns. Use `componentWillReceiveProps()` if you need to update `state` in response to `props` changes.
> Note
>

4
content/docs/thinking-in-react.md

@ -62,7 +62,7 @@ Now that we've identified the components in our mock, let's arrange them into a
## Step 2: Build A Static Version in React
<p data-height="600" data-theme-id="0" data-slug-hash="BwWzwm" data-default-tab="js" data-user="lacker" data-embed-version="2" class="codepen">See the Pen <a href="https://codepen.io/gaearon/pen/BwWzwm">Thinking In React: Step 2</a> on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
Now that you have your component hierarchy, it's time to implement your app. The easiest way is to build a version that takes your data model and renders the UI but has no interactivity. It's best to decouple these processes because building a static version requires a lot of typing and no thinking, and adding interactivity requires a lot of thinking and not a lot of typing. We'll see why.
@ -107,7 +107,6 @@ So finally, our state is:
## Step 4: Identify Where Your State Should Live
<p data-height="600" data-theme-id="0" data-slug-hash="qPrNQZ" data-default-tab="js" data-user="lacker" data-embed-version="2" class="codepen">See the Pen <a href="https://codepen.io/gaearon/pen/qPrNQZ">Thinking In React: Step 4</a> on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
OK, so we've identified what the minimal set of app state is. Next, we need to identify which component mutates, or *owns*, this state.
@ -133,7 +132,6 @@ You can start seeing how your application will behave: set `filterText` to `"bal
## Step 5: Add Inverse Data Flow
<p data-height="600" data-theme-id="0" data-slug-hash="LzWZvb" data-default-tab="js,result" data-user="rohan10" data-embed-version="2" data-pen-title="Thinking In React: Step 5" class="codepen">See the Pen <a href="https://codepen.io/gaearon/pen/LzWZvb">Thinking In React: Step 5</a> on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
So far, we've built an app that renders correctly as a function of props and state flowing down the hierarchy. Now it's time to support data flowing the other way: the form components deep in the hierarchy need to update the state in `FilterableProductTable`.

0
content/images/blog/error-boundaries-stack-trace-line-numbers.png → content/images/docs/error-boundaries-stack-trace-line-numbers.png

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

0
content/images/blog/error-boundaries-stack-trace.png → content/images/docs/error-boundaries-stack-trace.png

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

2
content/tutorial/nav.yml

@ -1,6 +1,6 @@
- title: Tutorial
items:
- id: tutorial
- id: before-we-start
title: Before We Start
href: /tutorial/tutorial.html#before-we-start
forceInternal: true

36
content/tutorial/tutorial.md

@ -3,7 +3,7 @@ id: tutorial
title: "Tutorial: Intro To React"
layout: tutorial
sectionid: tutorial
permalink: /tutorial/tutorial.html
permalink: tutorial/tutorial.html
redirect_from:
- "docs/tutorial.html"
- "docs/why-react.html"
@ -200,8 +200,8 @@ First, add a constructor to the class to initialize the state:
```javascript{2-7}
class Square extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
value: null,
};
@ -228,8 +228,8 @@ Now the `<button>` tag looks like this:
```javascript{10-12}
class Square extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
value: null,
};
@ -282,8 +282,8 @@ Pulling state upwards like this is common when refactoring React components, so
```javascript{2-7}
class Board extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
squares: Array(9).fill(null),
};
@ -399,8 +399,8 @@ Try clicking a square – you should get an error because we haven't defined `ha
```javascript{9-13}
class Board extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
squares: Array(9).fill(null),
};
@ -528,8 +528,8 @@ Let's default the first move to be by 'X'. Modify our starting state in our Boar
```javascript{6}
class Board extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
squares: Array(9).fill(null),
xIsNext: true,
@ -564,8 +564,8 @@ After these changes you should have this Board component:
```javascript{6,11-16,29}
class Board extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
squares: Array(9).fill(null),
xIsNext: true,
@ -715,8 +715,8 @@ First, set up the initial state for Game by adding a constructor to it:
```javascript{2-10}
class Game extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
history: [{
squares: Array(9).fill(null),
@ -1006,8 +1006,8 @@ First, add `stepNumber: 0` to the initial state in Game's `constructor`:
```js{8}
class Game extends React.Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {
history: [{
squares: Array(9).fill(null),
@ -1091,7 +1091,7 @@ Check out the final result here: [Final Result](https://codepen.io/gaearon/pen/g
If you have extra time or want to practice your new skills, here are some ideas for improvements you could make, listed in order of increasing difficulty:
1. Display the move locations in the format "(1, 3)" instead of "6".
2. Bold the currently-selected item in the move list.
2. Bold the currently selected item in the move list.
3. Rewrite Board to use two loops to make the squares instead of hardcoding them.
4. Add a toggle button that lets you sort the moves in either ascending or descending order.
5. When someone wins, highlight the three squares that caused the win.

20
gatsby-node.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';
@ -28,6 +28,9 @@ exports.modifyWebpackConfig = ({config, stage}) => {
exports.createPages = async ({graphql, boundActionCreators}) => {
const {createPage, createRedirect} = boundActionCreators;
// Used to detect and prevent duplicate redirects
const redirectToSlugMap = {};
const blogTemplate = resolve('./src/templates/blog.js');
const communityTemplate = resolve('./src/templates/community.js');
const docsTemplate = resolve('./src/templates/docs.js');
@ -114,13 +117,22 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
redirect = [redirect];
}
redirect.forEach(fromPath =>
redirect.forEach(fromPath => {
if (redirectToSlugMap[fromPath] != null) {
console.error(`Duplicate redirect detected from "${fromPath}" to:\n` +
`* ${redirectToSlugMap[fromPath]}\n` +
`* ${slug}\n`
);
process.exit(1);
}
redirectToSlugMap[fromPath] = slug;
createRedirect({
fromPath: `/${fromPath}`,
redirectInBrowser: true,
toPath: `/${slug}`,
}),
);
});
});
}
}
});

21
src/components/CodeEditor/CodeEditor.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';
@ -105,7 +105,7 @@ class CodeEditor extends Component {
overflow: 'hidden',
borderRadius: '10px 0 0 10px',
[media.lessThan('small')]: {
[media.lessThan('medium')]: {
borderRadius: '10px 10px 0 0',
},
}}>
@ -122,15 +122,24 @@ class CodeEditor extends Component {
height: '100%',
width: '100%',
borderRadius: '0',
maxHeight: '340px !important',
marginTop: '0 !important',
marginLeft: '0 !important',
paddingLeft: '0 !important',
marginRight: '0 !important',
paddingRight: '0 !important',
marginBottom: '0 !important',
paddingBottom: '20px !important',
[media.lessThan('medium')]: {
marginBottom: '0 !important',
},
'& pre.prism-code[contenteditable]': {
maxHeight: '280px !important',
outline: 0,
overflow: 'auto',
marginRight: '0 !important',
marginBottom: '0 !important',
},
}}
className="gatsby-highlight">
@ -147,7 +156,7 @@ class CodeEditor extends Component {
fontSize: 12,
lineHeight: 1.5,
[media.lessThan('small')]: {
[media.lessThan('medium')]: {
borderRadius: '0 0 10px 10px',
},
}}>
@ -183,7 +192,7 @@ class CodeEditor extends Component {
border: `1px solid ${colors.divider}`,
borderRadius: '0 10px 10px 0',
[media.lessThan('small')]: {
[media.lessThan('medium')]: {
borderRadius: '0 0 10px 10px',
},
}}>
@ -197,6 +206,8 @@ class CodeEditor extends Component {
<div
css={{
padding: 10,
maxHeight: '340px !important',
overflow: 'auto',
'& input': {
width: '100%',

2
src/components/CodeEditor/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/Container/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/ErrorDecoder/ErrorDecoder.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/ErrorDecoder/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/Flex/Flex.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/Flex/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/Header/Header.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/Header/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutFooter/ExternalFooterLink.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutFooter/Footer.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutFooter/FooterLink.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutFooter/FooterNav.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutFooter/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutHeader/Header.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutHeader/HeaderLink.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutHeader/SearchSvg.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/LayoutHeader/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/MarkdownHeader/MarkdownHeader.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/MarkdownHeader/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

7
src/components/MarkdownPage/MarkdownPage.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';
@ -26,6 +26,7 @@ const MarkdownPage = ({
authors,
createLink,
date,
enableScrollSync,
ogDescription,
location,
markdownRemark,
@ -87,7 +88,7 @@ const MarkdownPage = ({
<div css={{marginTop: 80}}>
<a
css={sharedStyles.articleLayout.editLink}
href={`https://github.com/facebook/react/tree/master/docs/${markdownRemark
href={`https://github.com/reactjs/reactjs.org/tree/master/content/${markdownRemark
.fields.path}`}>
Edit this page
</a>
@ -98,6 +99,7 @@ const MarkdownPage = ({
<div css={sharedStyles.articleLayout.sidebar}>
<StickyResponsiveSidebar
enableScrollSync={enableScrollSync}
createLink={createLink}
defaultActiveSection={findSectionForPath(
location.pathname,
@ -132,6 +134,7 @@ MarkdownPage.propTypes = {
authors: PropTypes.array.isRequired,
createLink: PropTypes.func.isRequired,
date: PropTypes.string,
enableScrollSync: PropTypes.bool,
location: PropTypes.object.isRequired,
markdownRemark: PropTypes.object.isRequired,
sectionList: PropTypes.array.isRequired,

2
src/components/MarkdownPage/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/StickyResponsiveSidebar/StickyResponsiveSidebar.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/StickyResponsiveSidebar/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/TitleAndMetaTags/TitleAndMetaTags.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/components/TitleAndMetaTags/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

10
src/css/algolia.css

@ -263,7 +263,6 @@
.algolia-autocomplete .ds-dropdown-menu [class^="ds-dataset-"] {
position: relative;
background: #fff;
border-radius: 4px;
overflow: auto;
padding: 0;
@ -336,6 +335,7 @@
}
.algolia-autocomplete .algolia-docsearch-suggestion--wrapper {
background-color: #fff;
width: 100%;
float: left;
padding: 8px 0 0 0;
@ -431,7 +431,8 @@
.algolia-autocomplete .algolia-docsearch-footer {
width: 110px;
background-color: #fff;
width: 100%;
height: 30px;
z-index: 2000;
float: right;
@ -446,8 +447,9 @@
background-size: 100%;
overflow: hidden;
text-indent: -9000px;
width: 100%;
width: 110px;
height: 100%;
display: block;
margin-left: -5px;
margin-left: auto;
margin-right: 5px;
}

2
src/layouts/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/pages/acknowledgements.html.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/pages/docs/error-decoder.html.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/blog.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/community.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/ButtonLink/ButtonLink.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/ButtonLink/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/ChevronSvg/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/ExternalLinkSvg/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/MetaTitle/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/NavigationFooter/NavigationFooter.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/components/NavigationFooter/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

103
src/templates/components/Sidebar/ScrollSyncSection.js

@ -0,0 +1,103 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the CC-BY-4.0 license found
* in the LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
'use strict';
import React, {Component} from 'react';
import Section from './Section';
class ScrollSyncSection extends Component {
constructor(props, context) {
super(props, context);
this.state = {
activeItemId: '',
itemTopOffsets: [],
};
this.calculateItemTopOffsets = this.calculateItemTopOffsets.bind(this);
this.handleResize = this.handleResize.bind(this);
this.handleScroll = this.handleScroll.bind(this);
}
componentDidMount() {
this.calculateItemTopOffsets();
window.addEventListener('resize', this.handleResize);
window.addEventListener('scroll', this.handleScroll);
}
componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
window.removeEventListener('scroll', this.handleScroll);
}
calculateItemTopOffsets() {
const {section} = this.props;
const itemIds = _getItemIds(section.items);
this.setState({
itemTopOffsets: _getElementTopOffsetsById(itemIds),
});
}
handleResize() {
this.calculateItemTopOffsets();
this.handleScroll();
}
handleScroll() {
const {itemTopOffsets} = this.state;
const item = itemTopOffsets.find((itemTopOffset, i) => {
const nextItemTopOffset = itemTopOffsets[i + 1];
if (nextItemTopOffset) {
return (
window.scrollY >= itemTopOffset.offsetTop &&
window.scrollY < nextItemTopOffset.offsetTop
);
}
return window.scrollY >= itemTopOffset.offsetTop;
});
this.setState({
activeItemId: item ? item.id : '',
});
}
render() {
const {activeItemId} = this.state;
return <Section isScrollSync activeItemId={activeItemId} {...this.props} />;
}
}
const _getItemIds = items =>
items
.map(item => {
let subItemIds = [];
if (item.subitems) {
subItemIds = item.subitems.map(subitem => subitem.id);
}
return [item.id, ...subItemIds];
})
.reduce((prev, current) => prev.concat(current));
const _getElementTopOffsetsById = ids =>
ids
.map(id => {
const element = document.getElementById(id);
if (!element) {
return null;
}
return {
id,
offsetTop: element.offsetTop,
};
})
.filter(item => item);
export default ScrollSyncSection;

13
src/templates/components/Sidebar/Section.js

@ -9,17 +9,16 @@
'use strict';
import React from 'react';
import {colors, media} from 'theme';
import isItemActive from 'utils/isItemActive';
import MetaTitle from '../MetaTitle';
import ChevronSvg from '../ChevronSvg';
// TODO Update isActive link as document scrolls past anchor tags
// Maybe used 'hashchange' along with 'scroll' to set/update active links
const Section = ({
activeItemId,
createLink,
isActive,
isScrollSync,
location,
onLinkClick,
onSectionTitleClick,
@ -67,6 +66,9 @@ const Section = ({
marginTop: 5,
}}>
{createLink({
isActive: isScrollSync
? activeItemId === item.id
: isItemActive(location, item),
item,
location,
onLinkClick,
@ -78,6 +80,9 @@ const Section = ({
{item.subitems.map(subitem => (
<li key={subitem.id}>
{createLink({
isActive: isScrollSync
? activeItemId === subitem.id
: isItemActive(location, subitem),
item: subitem,
location,
onLinkClick,

13
src/templates/components/Sidebar/Sidebar.js

@ -12,6 +12,7 @@
import React, {Component} from 'react';
import Flex from 'components/Flex';
import Section from './Section';
import ScrollSyncSection from './ScrollSyncSection';
import {media} from 'theme';
class Sidebar extends Component {
@ -24,9 +25,17 @@ class Sidebar extends Component {
}
render() {
const {closeParentMenu, createLink, location, sectionList} = this.props;
const {
closeParentMenu,
createLink,
enableScrollSync,
location,
sectionList,
} = this.props;
const {activeSection} = this.state;
const SectionComponent = enableScrollSync ? ScrollSyncSection : Section;
return (
<Flex
type="nav"
@ -46,7 +55,7 @@ class Sidebar extends Component {
},
}}>
{sectionList.map((section, index) => (
<Section
<SectionComponent
createLink={createLink}
isActive={activeSection === section || sectionList.length === 1}
key={index}

2
src/templates/components/Sidebar/index.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/docs.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/templates/home.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

3
src/templates/tutorial.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';
@ -27,6 +27,7 @@ const Tutorial = ({data, location}) => {
return (
<MarkdownPage
enableScrollSync
createLink={createLinkTutorial}
location={location}
markdownRemark={data.markdownRemark}

27
src/utils/createLink.js

@ -1,26 +1,21 @@
/**
* Copyright 2015-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';
import Link from 'gatsby-link';
import React from 'react';
import ExternalLinkSvg from 'templates/components/ExternalLinkSvg';
import isItemActive from 'utils/isItemActive';
import slugify from 'utils/slugify';
import {colors, media} from 'theme';
const createLinkBlog = ({item, location, section}) => {
const isActive = isItemActive(location, item);
const createLinkBlog = ({isActive, item, section}) => {
return (
<Link css={[linkCss, isActive && activeLinkCss]} to={item.id}>
{isActive && <span css={activeLinkBefore} />}
@ -29,7 +24,7 @@ const createLinkBlog = ({item, location, section}) => {
);
};
const createLinkCommunity = ({item, location, section}) => {
const createLinkCommunity = ({isActive, item, section}) => {
if (item.href) {
return (
<a css={[linkCss]} href={item.href} target="_blank" rel="noopener">
@ -46,15 +41,13 @@ const createLinkCommunity = ({item, location, section}) => {
);
}
return createLinkDocs({
isActive,
item,
location,
section,
});
};
const createLinkDocs = ({item, location, section}) => {
const isActive = isItemActive(location, item);
const createLinkDocs = ({isActive, item, section}) => {
return (
<Link
css={[linkCss, isActive && activeLinkCss]}
@ -65,9 +58,7 @@ const createLinkDocs = ({item, location, section}) => {
);
};
const createLinkTutorial = ({item, location, onLinkClick, section}) => {
const isActive = isItemActive(location, item);
const createLinkTutorial = ({isActive, item, onLinkClick, section}) => {
return (
<Link
css={[linkCss, isActive && activeLinkCss]}

2
src/utils/findSectionForPath.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/utils/isItemActive.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/utils/mountCodeExample.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

10
src/utils/sectionList.js

@ -1,13 +1,11 @@
/**
* Copyright 2015-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/utils/slugify.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
src/utils/toCommaSeparatedList.js

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
*/
'use strict';

2
static/_redirects

@ -0,0 +1,2 @@
/html-jsx.html http://magic.reactjs.net/htmltojsx.htm 301
/tips/controlled-input-null-value.html /docs/forms.html#controlled-input-null-value

21
static/html/single-file-example.html

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
</script>
</body>
</html>
Loading…
Cancel
Save