Compare commits

..

797 Commits

Author SHA1 Message Date
Dan Abramov
571a9208d5 Tweak blog post to match others 2017-09-26 11:39:18 +01:00
Paul O’Shannessy
f1a8b33a02 Fix author in latest blog post (#10827)
Fix this so that @nhunzaker gets his name up there for real (will want to cherry-pick back to master but the blog post isn't there either so I'll let y'all handle that)
2017-09-26 11:33:31 +01:00
Sophie Alpert
ffbc2db0e7 Merge branch '15.6-dev' into 15-stable 2017-09-25 17:06:40 -07:00
Nathan Hunzaker
5634f0d113 15.6.2 2017-09-25 17:02:44 -07:00
Sophie Alpert
8c3cececb7 15.x: BSD+Patents -> MIT 2017-09-25 17:02:44 -07:00
Sophie Alpert
080db9d3a7 15.x: File headers BSD+Patents -> MIT 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
838937189d Update timestamps 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
5be8f5f40b Update timestamps on post and changelog 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
cc9d64c681 Use standard method of testing for production 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
e0c864d2cf Correct ref warning entry in changelog 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
06d2556ccf Improve grammar on changelog #10025 entry 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
fe69ea48f9 Update changelog with #10025 2017-09-25 17:02:43 -07:00
Nathan Hunzaker
b2185d7321 Update release date 2017-09-25 17:02:43 -07:00
Ian Sutherland
1347b4a9d9 Added unit tests for creating an element with a ref in a constructor. Only set ReactCurrentOwner.current in dev mode when the component has no constructor. (#10025)
nhunzaker: I've added an additional line to the ref test that sets the
NODE_ENV invironment variable. This allows the test to pass.
2017-09-25 17:02:43 -07:00
Nathan Hunzaker
8af9dbf77c Add 15.6.2 blog post 2017-09-25 17:02:42 -07:00
Dan Abramov
86d88a07a9 Update error codes 2017-09-14 13:37:47 +01:00
Brian Emil Hartz
0d9b921ad5 More explicit class method for ref doc (#10228)
After realizing this was the second time I've visited this exact page within a year and second guessing myself that the `textInput` ref isn't actually the `<input />` element. I decided to attempt to make this a little more explicit; you are actually accessing the method on the child class and not the `focus` method on the dom input element. Having them named the same caused some confusion.

(cherry picked from commit 6d37c05dd7)
2017-09-10 14:49:02 -07:00
Taegon Kim
88453bdcd1 Add React Seoul 2017 to the conferences list (#10661)
(cherry picked from commit f76467e8e5)
2017-09-10 12:41:20 -07:00
Dan Abramov
0e2dba070a Blog post: DOM Attributes in React 16 (#10650)
* Blog post: DOM Attributes in React 16

* Testing the RC
2017-09-08 20:30:23 +01:00
Daniel Rotter
5b2fa6e2b1 Add AgentConf 2018 (#10614)
* Add AgentConf 2018

We are having another edition of the AgentConf in 2018, which has again a strong focus on react, and we'll be skiing again 😎 Last year's PR for reference: https://github.com/facebook/react/pull/8196

* Update conferences.md
2017-09-08 20:30:13 +01:00
Tyler Deitz
e19c738ce2 Update reference-events.md (#10554) 2017-09-08 20:29:16 +01:00
Robert Haritonov
aa2572e1fd add React Day Berlin (#10492) 2017-09-08 20:28:42 +01:00
Karthik Balakrishnan
354706ab8e Add ReactFoo 2017 to list of upcoming conferences (#10467) 2017-09-08 20:27:52 +01:00
Michiya
437dbea757 Update conferences.md (#10160) 2017-09-08 20:26:23 +01:00
Flarnie Marchan
bd92ae6efe Update error codes (#10621)
https://github.com/facebook/react/tree/master/scripts/release-manager#update-the-error-codes
2017-09-06 11:13:52 -07:00
Brian Vaughn
e6f5375653 Added "Advanced Guides" page about cross-origin Errros (#10457) 2017-08-14 13:44:37 -07:00
Nathan Hunzaker
c08911c0a7 Update React version in docs 2017-08-10 14:00:00 -04:00
Nathan Hunzaker
31ada74f34 Add 15.6.2 changelog 2017-08-10 13:57:24 -04:00
Nathan Hunzaker
f8afe8309b Update yarn.lock file 2017-08-10 13:41:24 -04:00
Nathan Hunzaker
c802f940ac Add controlList to DOM property whitelist (#9940)
See:

- https://github.com/WICG/controls-list/blob/gh-pages/explainer.md
- https://developers.google.com/web/updates/2017/03/chrome-58-media-updates#controlslist
2017-08-10 13:34:43 -04:00
Brandon Dail
3c55d12587 Use a closure to bind argument to callback in ReactErrorUtils (#8363)
* Use a closure to bind gaurded callback

This way the fake event isn't being implicitly passed into the event handler

* Add tests for ReactErrorUtils

Add fiber test report

Linting fixes
2017-08-10 13:34:33 -04:00
walrusfruitcake
dec3ed1556 move augmentClass definition above SyntheticEvent Proxy replacement (#10011) 2017-08-10 12:48:44 -04:00
Brandon Dail
16ed333e26 Add columns to isUnitlessNumber list 2017-08-10 12:38:28 -04:00
Ben Alpert
77b71fc3c4 Update installation.md 2017-08-05 13:15:08 +01:00
Devedse
8594fe291a Wop optimized this repository (#10374)
The Web Optimization Project optimized this repository. This commit contains the optimized files in this repository.
2017-08-04 14:42:48 +01:00
Dan Abramov
0cce0eb946 Update codes 2017-08-04 00:35:55 +01:00
Dan Abramov
bc472d8389 Add documentation about <script crossorigin> for React CDN usage 2017-08-03 16:14:51 +01:00
Dan Abramov
80255c8d3b react-dom-factories@1.0.1 2017-08-02 19:15:18 +01:00
Dan Abramov
116a878b15 Remove React from peers of react-dom-factories
Fixes #10358
2017-08-02 19:14:57 +01:00
Dan Abramov
d3cef408bb Use createElement rather than createFactory in react-dom-factories
This is a tiny bit more future-proof.
2017-08-02 19:14:17 +01:00
Brandon Dail
a7f0119bc1 Use boolean assertion for documentMode check (#10032) 2017-08-01 15:19:14 -05:00
Dan Abramov
c0492cb555 Make it more specific 2017-07-27 23:45:15 +01:00
Fernando Montoya
63bd514db3 Add Babel plugin note to Error boundaries post (#10313)
* Add Babel plugin note to Error boundaries post

* Added section with screenshots

* Add context to Component stack traces

* Update 2017-07-26-error-handling-in-react-16.md

* Move section, more minor changes

* Change pics
2017-07-27 23:26:32 +01:00
Toru Kobayashi
ca0a4a948b Add a link for the error boundaries codemod into the blog post (#10305)
* Add a link for the error boundaries codemod into the blog post

* Update 2017-07-26-error-handling-in-react-16.md
2017-07-27 14:58:21 +01:00
Dan Abramov
716abcd45a Reword further 2017-07-27 10:48:47 +01:00
Daniel Lo Nigro
7dae9312ee Replace "children (and grandchildren)" with "descendants" (#10297) 2017-07-27 10:24:36 +01:00
Dan Abramov
d40487539a Link to React 16 beta 2017-07-26 21:20:33 +01:00
Dan Abramov
b7dd6d4e25 Blog post: Error Handling in React 16 (#10267)
* Blog post: Error Handling in React 16

* Change the date
2017-07-26 21:20:29 +01:00
Flarnie Marchan
ab4c85ebb3 Regenerate error codes and update bundle size stats (#10287) (#10288)
* Regenerate error codes and update bundle size stats (#10287)

* Updated error codes (after merging in missing code from 15 stable) (#10290)
2017-07-26 12:23:42 -07:00
Jason Quense
b1d52b6cd1 Fix uncontrolled radios (#10186)
* Fix uncontrolled radios

* cherry-pick regression test from master

* prettier
2017-07-24 14:20:41 -04:00
Dan Abramov
6d40e0c3e0 Tweak deprecation messages to be less scary (#10145)
(cherry picked from commit 2e2f503cb8)
2017-07-11 14:06:11 +01:00
Nick Kasten
8057c0a784 Updated Immutable Data Stuctures Docs (#9845)
* updated immutable data structures section

* improved immutable clarifications

* changes to example immutable code

(cherry picked from commit 8f4d30737d)
2017-07-11 14:06:11 +01:00
Ilya Gelman
c0633b37a2 Add ReactNext 2017 to conference list (#10114)
(cherry picked from commit b22387d4fe)
2017-07-11 14:06:10 +01:00
Andrew Rota
14e6e2cd94 Add React Boston 2017 to upcoming conferences (#10099)
(cherry picked from commit a39858f399)
2017-07-11 14:06:10 +01:00
Guilherme Ruiz
6a057a0a5c Fix the data-height of Step 5 CodePen embed (#10083)
(cherry picked from commit 83f56370e6)
2017-07-11 14:06:10 +01:00
Kiho · Cham
141179a24e doc: fix the order of lint and prettier (#10095)
(cherry picked from commit 03db57aa71)
2017-07-11 14:06:09 +01:00
Almero Steyn
c218cab34d docs(a11y): Small fixes (#10079)
(cherry picked from commit 79868a978d)
2017-07-11 14:06:09 +01:00
Henry Harris
5686ab15d6 Tiny changes to tutorial (#10048)
* Initial commit

* PR feedback
2017-06-29 16:00:48 +01:00
Almero Steyn
d339eafa10 [Docs: A11y] Add accessibility docs (#9519)
* [Docs: A11y] Add accessibility docs

* Fix the link

* Replace link image

* Tweak style
2017-06-26 18:18:50 +01:00
newvlad
1be7cca598 Create higher-order-components.md (#9976) 2017-06-26 18:18:39 +01:00
Sasha Aickin
61dedda93e As pointed out by @gaearon in code review comment https://github.com/facebook/react/pull/10024#discussion_r123649131 , ReactDOMServer is an object, not a class. (#10027) 2017-06-26 18:18:19 +01:00
Dan Abramov
76b916bf32 Fix the test again 2017-06-15 15:46:13 +01:00
Dan Abramov
f4fe34d0e7 Bump docs to 15.6.1 2017-06-15 15:32:39 +01:00
Dan Abramov
5d497a60c9 Changelog for 15.6.1 (#9977) 2017-06-15 15:23:57 +01:00
Dan Abramov
07fe7ad6d7 Fix isMounted test to include the latest fix 2017-06-15 15:22:55 +01:00
Dan Abramov
7efd2e58d0 Fix tests on CI to account for prop-types change 2017-06-15 01:24:04 +01:00
Dan Abramov
a3d0dbcaa9 Try to enable Yarn on 15-stable (#9971) 2017-06-15 00:59:07 +01:00
Dan Abramov
0c102ac204 15.6.1 2017-06-15 00:41:30 +01:00
Dan Abramov
9ba0c8097f Merge branch '15.6-dev' into 15-stable 2017-06-15 00:34:49 +01:00
Dan Abramov
5b89c1bb2d Try to re-enable Prettier 2017-06-15 00:30:50 +01:00
Dan Abramov
83d0dc4989 Remove unused build tasks 2017-06-15 00:22:06 +01:00
Dan Abramov
230d0ec277 Delete unused packages 2017-06-15 00:14:01 +01:00
Dan Abramov
240874d0f4 Bump dependencies 2017-06-15 00:13:13 +01:00
Dan Abramov
4013e234c5 Merge branch '15.6-dev' into 15-stable 2017-06-15 00:08:38 +01:00
Dan Abramov
d494d2d332 Temporarily disable prettier on CI 2017-06-15 00:08:14 +01:00
Bogdan Chadkin
80255d10bf Prevents adding units to css custom properties (#9966)
* Prevents adding units to css custom properties

* Fix code style

* Optimize custom property checking

* Prevents adding units to css custom properties in markup creation

* Update passing tests

* Fix argument name and reuse check in DEV
2017-06-14 23:51:18 +01:00
Dan Abramov
782e433788 Merge branch '15.6-dev' into 15-stable 2017-06-14 23:16:25 +01:00
Flarnie Marchan
ae94ea76f9 Disable 'comma-dangle' eslint rule for './addons' (#9965)
**what is the change?:**
Added an `eslintrc` which disables the 'comma-dangle' rule just for
addons.

**why make this change?:**
To get CI passing again on the 15* branches.

We don't have dangling commas in the addons because it breaks GCC under
certain conditions. This doesn't affect React because we use Babel with
React, but it's not worth setting up Babel for the addons at this time.

**test plan:**
`yarn lint`

**issue:**
None - hopefully will fix this before it's a problem
2017-06-14 22:13:59 +01:00
Jason Quense
2ddff2e339 Backport Safari fix for input changes (#9960)
fixes #9956
2017-06-14 16:20:10 +01:00
Flarnie Marchan
123c7cddfd Merge branch '15-dev' into 15-stable
To pull in https://github.com/facebook/react/pull/6648/files
fixes https://github.com/facebook/react/issues/9956
2017-06-14 08:03:40 -07:00
Flarnie Marchan
cd262c7e04 remove file mistakenly added in merge conflict resolution 2017-06-14 08:03:11 -07:00
Flarnie Marchan
d5c2bdb92f Merge branch '15.6-dev' into 15-dev
In order to add https://github.com/facebook/react/pull/6648/files
fixes https://github.com/facebook/react/issues/9956
2017-06-14 07:55:30 -07:00
Jason Quense
0deda1f5e7 Bail out of dedupe logic in cases where there is an incomplete value descriptor (#6648) 2017-06-14 07:44:30 -07:00
Dan Abramov
461a5a2529 Add addon changes to 15.6.0 changelog (#9958)
* Add addon changes to 15.6.0 changelog

* Oops

* Add to blogpost
2017-06-14 14:03:52 +01:00
Dan Abramov
3377abf46a Add future changelog for 15.6.0 addon release (#9953) 2017-06-14 14:02:40 +01:00
Dan Abramov
24e698a93b Reword animation documentation deprecation (#9957) 2017-06-14 14:01:46 +01:00
Dan Abramov
4f17e8a03a Merge branch '15.6-dev' into 15-stable 2017-06-14 14:01:31 +01:00
Dan Abramov
d9d8cf658a 15.6.0 of addons 2017-06-14 13:51:05 +01:00
Dan Abramov
820310fcf4 Update transitiongroup readmes to be less scary 2017-06-14 13:14:24 +01:00
Dan Abramov
4d44dfb2a8 No need to call it deprecated 2017-06-14 12:49:08 +01:00
Dan Abramov
00917c80e8 Remove trailing commas in addons 2017-06-14 12:38:03 +01:00
Flarnie Marchan
c1fe2549c8 Blog post for 15.6.0 (#9950)
* Blog post for 15.6.0

**what is the change?:**
A short and sweet summary of 15.6.0 changes

**why make this change?:**
To thank community contributors and call out important changes.

**test plan:**
Visual inspection.
I also looked it over in a markdown viewer - http://dillinger.io/

**issue:**
https://github.com/facebook/react/issues/9398

* Add 'Installation' and 'Changelog' to 15.6.0 blog post

**what is the change?:**
Added the 'Installation' section we have on most release blog posts,
customized for the 15.6.0 version of React.
Added the 'Changelog' from master to the blog post.

**why make this change?:**
To show folks how to install React and what changes are in this release.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398

* Improvements to blog post, and add self to `authors.yml`

**what is the change?:**
- Add self to contributors so my name turns into a link
- Use backticks for code-ish things
- Second header to ##, not #
- Change production mode link to the new address per @bvaughn's comment
- Update changelog with fixes from https://github.com/facebook/react/pull/9951

**why make this change?:**
Make things more clear and accurate.

**test plan:**
Visual inspect - @flarnie will paste an image of how it appears in the
actual docs.

**issue:**
https://github.com/facebook/react/issues/9398

* Further improvements to 15.6 blog post

**what is the change?:**
- Reword heading about deprecation warning changes
- add 'br' s to the list of installation options
- add some stray missing backticks

**why make this change?:**
Clarity and readability

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-13 15:59:54 -07:00
Dan Abramov
a5e69ca8ea Add missing headers 2017-06-13 23:44:23 +01:00
Dan Abramov
4db80b960c Use lowPriorityWarning for TestUtils too 2017-06-13 23:42:32 +01:00
Dan Abramov
a3ff734cbc Add missing devDependency 2017-06-13 23:22:39 +01:00
Dan Abramov
4ac06723e6 Addons: 15.6.0-rc.0 2017-06-13 23:15:16 +01:00
Dan Abramov
16d7773b3c Minor fixes to 15.6.0 changelog (#9951)
* Minor fixes to 15.6.0 changelog

* Remove remaining double space

* Backticks
2017-06-13 14:56:09 -07:00
Dan Abramov
0652bb4633 Minor fixes to 15.6.0 changelog (#9951)
* Minor fixes to 15.6.0 changelog

* Remove remaining double space

* Backticks
2017-06-13 14:54:16 -07:00
Dan Abramov
8af5d233ef Minor fixes to 15.6.0 changelog (#9951)
* Minor fixes to 15.6.0 changelog

* Remove remaining double space

* Backticks
2017-06-13 14:53:07 -07:00
Flarnie Marchan
501cb45b51 15.6.0 2017-06-13 10:14:23 -07:00
Flarnie Marchan
156dd49a44 Update yarn.lock again 2017-06-13 10:14:23 -07:00
Dan Abramov
129307f8a4 Add build process to all addons (#9946)
* Build createFragment addon

* Tack the addon onto React.addons object

* Generalize build process for all addons

* Fix lint

* Fix lint again
2017-06-13 18:08:17 +01:00
Flarnie Marchan
78eda5525b Revert "Ran prettier"
This reverts commit 1de60827e3.
2017-06-13 09:09:40 -07:00
Flarnie Marchan
1de60827e3 Ran prettier 2017-06-13 09:00:37 -07:00
Flarnie Marchan
47334a18d2 Update changelog
**what is the change?:**
`git checkout master -- CHANGELOG.md`
Then made the 15.6 release no longer wrapped in 'details' tag.

**why make this change?:**
We are releasing 15.6 :D

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-13 08:45:41 -07:00
Flarnie Marchan
7c2ce278c5 Update Yarn lockfile 2017-06-13 08:42:42 -07:00
Flarnie Marchan
b0a67c9fa9 Merge branch '15-dev' into 15-stable
I would prefer to rebase but was not able to.

1) There were a couple of conflicts;
	addons/create-react-class/package.json
	src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js
2) Force pushing the result of the rebase was a no-go because
   `15-stable` is a protected branch.

So merging is ok too.

For more details about all the commits in this merge, see the `15-dev`
branch commit history from cef396d092 to d095bc8391
2017-06-13 07:35:03 -07:00
Flarnie Marchan
d095bc8391 bump minor version of create-react-class 2017-06-13 07:23:40 -07:00
Dan Abramov
9ac30f5477 Delete accidental .babelrc 2017-06-13 15:03:27 +01:00
Dan Abramov
f127ba6b21 Add build process for createReactClass (#9943)
* Switch trailing comma to ES5 mode in addons

* Add build process for createReactClass

* Test UMD bundles on CI

* Fix lint
2017-06-13 15:00:10 +01:00
Flarnie Marchan
207f3ef457 Update minified version of 'create-react-class' (#9939)
**what is the change?:**
We ran the latest version of
`addons/create-react-class/create-react-class.js` through https://jscompress.com/

**why make this change?:**
The last corner case I'm thinking of is this:
 - The `createClass` deprecation warning never went out in 15.5, and is going out now for real in 15.6.
 - The `createClass` UMD build is broken for AMD/CommonJS, but we fixed it. But not for the minified version of the file.
 - If someone see the warning, and tries to use the UMD build, then it's going to be broken in some cases.
 - Since we're skipping mentioning the add-ons in the blog post, and this might be a new warning for them, this could be a nasty surprise for folks.

We can do a quick 15.5.4 release of that package, we would at least fix that case.

This diverges from what @gaearon is doing to fix the add-ons. I would
probably try to use cherry-pick and interactive rebase to move this
commit to right after
ce3ecfb1df
and then do the patch release of `create-react-class` from that spot in
history.

Alternately I can merge this into the forked branch
`15.6-before-addon-reconstruction` and then do the patch release from
there.

**test plan:**
I didn't test this. Ideally minifying this file won't break anything,
and it's high cost to test add-ons until we have some repeatable tests
in place.

**issue:**
https://github.com/facebook/react/issues/9765
2017-06-12 16:41:59 -07:00
Dan Abramov
66b42830e0 Fix doc styling and formatting issues 2017-06-12 16:33:42 -07:00
Danilo Vitoriano
c62675cda4 Move Past Confs, add React Conf Brazil 2017 (#9697)
* move past confs, add React Conf Brazil 2017

* move react europe to past confs

* resolve react europe conflicts

* Create conferences.md
2017-06-12 16:33:42 -07:00
Mario Souto
f931ad7d25 Remove extra brace (#9910) 2017-06-12 16:33:42 -07:00
Victoria Quirante
152d94d898 Adding React Alicante 2017 to upcoming conferences (#9897) 2017-06-12 16:33:42 -07:00
Kurt Furbush
debf4f85e6 Update reference-react-component.md (#9863)
Grammatical edit to match same statement in state-and-lifecycle.html
2017-06-12 16:33:42 -07:00
Garmash Nikolay
6bef36d9fa Fix url to ng-animate (#9859) 2017-06-12 16:33:41 -07:00
Fernando Montoya
a5e0067358 Update webpack according to brand guidelines (#9595)
* Update webpack according to brand guidelines

* Change all ocurrences to webpack
2017-06-12 16:33:41 -07:00
Ricardo
b0777a695a Insert blockquote on prop value explanation. (#9770)
While reading the page, the "chain of thought" is broken by stating that the `tempertature` and `onTemperatureChange` don't have any special meaning. Making this a blockquote makes that note look more like a comment and keep the "chain of thought" intact.
2017-06-12 16:33:41 -07:00
cjshawMIT
eec984d80d Clarifying how to apply aria-* attributes (#9843)
Provide explicit example of what "keep lowercase" means for `aria-*` attributes.
2017-06-12 16:33:41 -07:00
Lipis
b77fd87b52 Rename Javascript to JavaScript (#9796) 2017-06-12 16:33:41 -07:00
Lipis
4def415fb5 Rename Github to GitHub (#9797)
(cherry picked from commit 07d229b28e)
2017-06-12 16:33:41 -07:00
Erik Hellman
81d1519ebb Add Videos link to React Europe 2017 (#9751)
(cherry picked from commit d30bc9807e)
2017-06-12 16:33:41 -07:00
Flarnie Marchan
9d60d38abe Add 'Test Utils' docs back to main navigation (#9676)
* Add 'Test Utils' docs back to main navigation

**why make this change?:**
We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs.

**test plan:**
Manually tested the website - will insert a screenshot.

**issue:**
https://github.com/facebook/react/issues/9651

* Move test-utils docs to reference section

**what is the change?:**
Moved from 'advanced guides' to 'reference'

**why make this change?:**
It makes more sense as a reference

**test plan:**
Visual inspection (flarnie may add a screenshot)

**issue:**

* Add back the shallow renderer docs and remove outdated docs

**what is the change?:**
- Remove outdated 'shallow renderer' docs on 'test utils' page, and point to the updated 'shallow renderer' docs.
- Re-add a link to the updated 'shallow renderer' docs on the main navigation.

**why make this change?:**
This was already approved in https://github.com/facebook/react/pull/9331 which was then cherry-picked to https://github.com/facebook/react/pull/9359/commits and landed on master.

I'm not sure why some of these changes didn't persist. For now just adding back the changes we need.

**test plan:**
Manually inspected website - will insert screenshots.

**issue:**

* Further improvements to 'shallow rendering' and 'test utils' docs

Thanks @gaearon for the improvements!

**what is the change?:**
- Remove <hr/> from end of 'shallow rendering' docs
- 'documents' -> 'documentation'
- Move 'shallow rendering' redirection section to top of 'test utils' docs
- Add intro sentence about testing to 'shallow rendering' docs

**why make this change?:**
Documentation helps people learn.

**test plan:**
Visual inspection

(cherry picked from commit 114b9c5500)
2017-06-12 16:33:41 -07:00
Will Myers
f60f5fe77b Update blog post which creates unhandled promise rejection (#9668)
* Update 2015-12-16-ismounted-antipattern.md

In case anybody else stumbles across this old blog post, I wanted to submit a patch to help with unhandled rejections.

`#then` and `#catch` each return new Promise instances, so here we actually create two new promises (that aren't assigned).  If the argument promise to `#makeCancelable` rejects, the promise created by `#then` will be an unhandled rejection, which in Node 7 will be an uncaught error.

By using the second argument of `#then` to handle rejections instead, we don't need to worry about the runtime finding any unhandled rejections here.

* Style updates

* Add update notice

(cherry picked from commit 546e7721ec)
2017-06-12 16:33:41 -07:00
Max Donchenko
88815d6eeb Fix typo (#9786)
(cherry picked from commit 43f2ea079c)
2017-06-12 16:33:41 -07:00
Danny Hurlburt
1a663a4a3f Bind handleChange Instead of Calling (#9764)
(cherry picked from commit 1f667fd37f)
2017-06-12 16:33:41 -07:00
Samuel Hapák
db6c10c1e3 Add ReactiveConf (#9723)
(cherry picked from commit 1f80931d32)
2017-06-12 16:33:41 -07:00
Erik Hellman
018189a3e7 Move ReactEurope 2017 from Upcoming Conferences to Past Conferences (#9726)
(cherry picked from commit 5b7e81579d)
2017-06-12 16:33:41 -07:00
Hikaru Suido
74861dd9b0 Move previous events to the end (#9729)
(cherry picked from commit 3d6d641a8c)
2017-06-12 16:33:41 -07:00
Dave Lunny
80252af027 "Timeline" => "Performance" (#9602)
As of Chrome 58, the Timeline tab is now called the Performance tab, this updates the "Optimizing Performance > Profiling Components with Chrome Performance" section of the docs to reflect that.
(cherry picked from commit 5cf571839e)
2017-06-12 16:33:41 -07:00
shifengchen
9a2ddbddc9 Edit two errors in docs (#9659)
(cherry picked from commit d7e6ef0f88)
2017-06-12 16:33:41 -07:00
Dan Abramov
0bee1300bf New blog post: What's New in Create React App (#9719) 2017-06-12 16:33:41 -07:00
Carolina Powers
7a3472ea53 Fix typo on tutorial.md. (#9644)
The absence of the word `this` will cause CodePen
to scream at you. This fix should avoid that.
(cherry picked from commit 7c1e971e7f)
2017-06-12 16:33:40 -07:00
Dan Abramov
dd988162a1 react-addons-create-fragment@15.5.4 2017-06-12 16:33:40 -07:00
Dan Abramov
a8e2a33f1e create-react-class@15.5.3 2017-06-12 16:33:40 -07:00
Dan Abramov
18eff07423 Fix horizontal scrolling in docs (#9613)
(cherry picked from commit 6facb85f85)
2017-06-12 16:33:40 -07:00
Dan Abramov
1f943df61d Fix sequencing in the Tutorial (#9615)
* Fix sequencing in the Tutorial

* Update tutorial.md

* Update tutorial.md

(cherry picked from commit 138ff5e46b)
2017-06-12 16:33:40 -07:00
Dan Abramov
60332131d9 Tweak Tutorial based on feedback 2017-06-12 16:33:40 -07:00
Dan Abramov
c51f8bc995 Bump docs version 2017-06-12 16:33:40 -07:00
Dan Abramov
3b7a6c8b56 Fix mobile layout 2017-06-12 16:33:40 -07:00
Dan Abramov
aef13f093d Fix a typo 2017-06-12 16:33:40 -07:00
Dan Abramov
5458982197 Use a more specific link 2017-06-12 16:33:40 -07:00
Addy Osmani
3300ecb48a Add DEV mode note to installation doc (#8784) (#9157)
* Add DEV mode note to installation doc (#8784)

* Address feedback from Dan on wording

(cherry picked from commit f86256ece0)
2017-06-12 16:33:40 -07:00
Dan Abramov
bf4af51c99 Add more info about building for production (#9592)
* Add more info about building for production

* Add more info to the docs

(cherry picked from commit 185db64c76)
2017-06-12 16:33:40 -07:00
Joe Critchley
4700f30d19 [Docs] Show the name 'React' first in the homepage's <title> (#9582)
(cherry picked from commit 109d1c95e3)
2017-06-12 16:33:40 -07:00
Frankie Bagnardi
e9c77935b4 [Tutorial] Make it easier to follow the instructions (#9454)
* tutorial: adds note about onClick

* tutorial: show full square component

* merge

* fixes line number

* tutorial: misc changes

* fixes Board render initial code sample

* [tutorial] adds codepen links and misc small fixes

* removes useless arrow functions, #9531

* {this.renderSquare} new lines

* be more explicit about history state

* fixes highlight

* following along locally

* changes todo to this.props.value

* removes calculateWinner from initial codepens and includes it in tutorial

* removes note about calculateWinner at end of file

* adds debug-view and debug-view-final

* removes debug view, updates codepen instructions

* adds another codepen

* tutorial.md

* tutorial.md

* tutorial.md

* tutorial.md

* Put . into links for consistency with docs

* Make the very first change easier to follow

* A few more changes

(cherry picked from commit e9d6f3f10e)
2017-06-12 16:33:40 -07:00
Marcos Ojeda
2413107b1d docs better indicate that state updaters shallowly merge with state (#9554)
this was a surprise to me because the docs seemed to indicate that when
using an updater, the result _needed_ to be a new state object. I was
[not alone](https://twitter.com/ken_wheeler/status/857939690191806464)
i think in discovering this as a result of the previous tweet in the
thread.
(cherry picked from commit f737d63302)
2017-06-12 16:33:40 -07:00
Sriram Thiagarajan
f66c60c636 pre format only compile time errors (#9538)
* pre format only compile time errors

* Style tweak

(cherry picked from commit 70c01963d9)
2017-06-12 16:33:40 -07:00
Paul O’Shannessy
11ef9da924 Don't build gh-pages branch on CircleCI (#9442) 2017-06-12 16:33:40 -07:00
wacii
edd83dd8fc Add guide on integrating with non-react code (#9316)
* Add guide on integrating with non-react code

* Capitalize guide title

* Make links to other docs relative

* Rephrase 'What it does do'

* Remove experimental syntax

* Capitalize Backbone

* Remove empty lifecycle method in generic jQuery example

* Use shouldComponentUpdate() not componentWillUpdate()

* Prefer single quotes

* Add cleanup to generic jQuery example

* Capitalize React

* Generalize the section on Backbone Views

* Generalize the section on Backbone Models, a little

* Add introduction

* Adjust wording

* Simplify ref callbacks

* Fix typo in generic jQuery example

* Fix typos in Backbone models in React components

* Fix more typos in Backbone models in React components

* Add generic section on integrating with other view libraries

* Stress the benefits of an unchanging React element

* Small changes to introduction

* Add missing semicolon

* Revise generic jQuery wrapper section

Moved the section on using empty elements to prevent conflicts above the
code example and added brief introduction to that example.

* Add usage example for Chosen wrapper

* Prevent Chosen wrapper from updating

* Note that sharing the DOM with plugins is not recommended

* Mention how React is used at Facebook

* Mention React event system in template rendering section

* Remove destructuring from function parameters

* Do not name React components Component

* Elaborate on unmountComponentAtNode()

* Mention preference for unidirectional data flow

* Rename backboneModelAdapter

* Replace rest syntax

* Respond to updated model in connectToBackboneModel

* Rewrite connectToBackboneModel example

* Rework connectToBackboneModel example

* Misc changes

* Misc changes

* Change wording

* Tweak some parts

(cherry picked from commit 1816d06d6b)
2017-06-12 16:33:40 -07:00
RSG
292565fbc3 React.createElement syntax (#9459)
* React.createElement syntax

Added React.createElement syntax.
I think this is required for this tutorial.

* Reword

(cherry picked from commit 9824d52a4c)
2017-06-12 16:33:40 -07:00
Sriram Thiagarajan
34ab372824 fixed error formatting in live editor (#9497)
(cherry picked from commit 7ccfb07337)
2017-06-12 16:33:39 -07:00
Daniel Lo Nigro
cf41c522a9 [site] Load libraries from unpkg (#9499)
* [site] Load libraries from unpkg

* Revert Gemfile changes

(cherry picked from commit cf24d87177)
2017-06-12 16:33:39 -07:00
chocolateboy
fc33c50020 [Docs] Fix confusing description for the <script>...</script> usage (#9502)
* Fix confusing description for the <script>...</script> usage

* Update jsx-in-depth.md

* Update reference-react-dom-server.md

* Update reference-react-dom.md

* Update reference-react.md

(cherry picked from commit 3d60d4cc7d)
2017-06-12 16:33:39 -07:00
Dmitri Zaitsev
4ad20dbf00 Add reference to the Hyperscript libraries (#9517)
* Add reference to the Hyperscript libraries

I feel these should be mentioned as they provide terser syntax than using `R.createElement` directly, even with a shorthand.

* Rephrase

(cherry picked from commit a8c223ab41)
2017-06-12 16:33:39 -07:00
Frankie Bagnardi
e85ec2f735 adds indirect refs to docs (#9528)
* adds indirect refs to docs

* Add more info

* Explain clearer

* Rephrase

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

(cherry picked from commit 14fa8a5452)
2017-06-12 16:33:39 -07:00
Maciej Kasprzyk
5b77e75b6a Describe fixtures dir in the codebase overview (#9516)
* Describe fixtures dir in overview

* Fix folder name

(cherry picked from commit d12c41c7a6)
2017-06-12 16:33:39 -07:00
Jen Wong
efd2808071 Updates how-to-contribute.md to use JSFiddle referenced in submit Git issue template (#9503)
(cherry picked from commit c8a64e2637)
2017-06-12 16:33:39 -07:00
Flarnie Marchan
4a91038cef Add link to 'Typechecking with PropTypes' under 'Advanced Guides' (#9472)
This should have been retained in our docs, since PropTypes are only
moved and not deprecated.

Partially handles #9467, and I'll make a separate PR to
https://github.com/reactjs/prop-types to add more docs to the README
there.
(cherry picked from commit 39ca8aacf8)
2017-06-12 16:33:39 -07:00
David Hu
7723dc4a39 Add more details in jsx-in-depth.md (#9006)
* jsx-in-depth.md add ternary statement for javascript expressions section

* jsx-in-depth.md add explanation to get falsey values for props

* update jsx-in-depth.md

* ensure links work locally, remove section about falsey prop values

* Fix links
2017-06-12 16:33:39 -07:00
Almero Steyn
11d2471640 [Docs: Installation] Fix tabs responsive layout - Resubmit (#9458)
* [Docs: Installation] Fix tabs responsive layout

* Move tabs a pixel down

* Remove left margin on first tab

* Remove the long line

* Fix mobile styles

(cherry picked from commit a92128e7fb)
2017-06-12 16:33:39 -07:00
Almero Steyn
a7524ab0dd [Docs] Add accessibility to tabs in installation documentation (#9431)
* Add accessibility to tabs in installation documentation

* Change color and fix styling

(cherry picked from commit 9526174e30)
2017-06-12 16:33:39 -07:00
Fabrizio Castellarin
dd8ac14522 Reorganize the "following along" instructions (#9453)
* Reorganize the "following along" instructions

* Minor tweaks

(cherry picked from commit 1ce562ead3)
2017-06-12 16:33:39 -07:00
Filip Hoško
4b577eb731 FIX: Move CRA build info under it's tab page (#9452)
* FIX: Move CRA build info under it's tab page

* Add some links
2017-06-12 16:33:39 -07:00
Dan Abramov
3f8c23e628 Tweak tutorial structure 2017-06-12 16:33:39 -07:00
Dan Abramov
ac59a271cb Add missing tutorial sidebar links 2017-06-12 16:33:39 -07:00
Dan Abramov
1e68095b91 Minor tutorial nits 2017-06-12 16:33:39 -07:00
Dan Abramov
17d5b63e36 Fix duplicate sentence 2017-06-12 16:33:39 -07:00
Dan Abramov
0103dd1d38 Minor tweaks to tutorial 2017-06-12 16:33:39 -07:00
Frankie Bagnardi
28c914decf [Tutorial] ES6, installation, and button closing tag (#9441)
* adds notes to tutorial on es6 and installation

* fixes tutorial mention of opening button tag

* More writing

* Update
2017-06-12 16:33:39 -07:00
Abhishek Soni
1ad0a3309f Fixed grammar (#9432)
* Update codebase-overview.md

* Some more fixes

(cherry picked from commit d724115144)
2017-06-12 16:33:39 -07:00
hanumanthan
a5d07f0cac Lift state up - Updating the documentation to mention that onClick is a synthetic event handler (#9427)
* Lift state up - Updating the documentation to mention that onClick is a synthetic event handler

* Review comments - Rephrase to handle synthetic events and event handler patterns

* Tweak

(cherry picked from commit 53a3939fb0)
2017-06-12 16:33:39 -07:00
Michał Ordon
8706e4390f Sort out conferences by date (#9172)
(cherry picked from commit 37f9e35ad9)
2017-06-12 16:33:39 -07:00
Jayen Ashar
8b71e9fced Update jsx-in-depth.md (#9178)
* Update jsx-in-depth.md

Line 9 isn't changed

* Move selection down

* Fix

(cherry picked from commit ccb38a96cf)
2017-06-12 16:33:39 -07:00
Fraser Haer
a6102842ac Unique headings for linking purposes (#9259)
Previously two headings were 'Javascript Expressions' - now 'Javascript
Expressions as Props' and 'Javascript Expressions as Children'
(cherry picked from commit 363f6cb2e5)
2017-06-12 16:33:39 -07:00
NE-SmallTown
97542e7a99 [Documentation] Impreove the react-component section of doc (#9349)
* Impreove react-component of doc

[#9304](https://github.com/facebook/react/issues/9304)

* update description

* add missing space

(cherry picked from commit 359f5d276f)
2017-06-12 16:33:39 -07:00
Abhay Nikam
7b7a3e9860 Updated the Good First Bug section in readme (#9429)
* Updated the Good First Bug section in readme

* Inconsistent use of quotes. Prefered single quotes instead of double quotes

* Updated Good first bug link in how_to_contribute doc.

* Undo JSX attribute quote change

* don't capitalize "beginner friendly issue"

(cherry picked from commit 36c935ca8f)
2017-06-12 16:33:39 -07:00
Dan Abramov
7bdf33b2c5 Switch Installation to a tab when hash is present (#9422) 2017-06-12 16:33:38 -07:00
hanumanthan
dda27a3515 Refractor docs to indicate that state set to props in constructor will not recieve the updated props (#9404) 2017-06-12 16:33:38 -07:00
Marks Polakovs
bed4e33259 Add tabs to installation page (#9275, #9277) (#9401)
* Add tabs to installation page (#9275, #9277)

This adds tabs for create-react-app and existing apps to the installation section of the docs. The tab implementation is a simplified version of React Native's installation page.

Fixes #9275.

* Use classList instead of className

* Use same implementation as in RN
2017-06-12 16:33:38 -07:00
Jack
f56ba1467f Update proptypes doc (#9391)
* Update proptypes doc

* Removed note
2017-06-12 16:33:38 -07:00
Eric Elliott
6a095209fe Docs: Clarification of setState() behavior (#9329)
* Clarification of setState() behavior

`setState()` is a frequent source of confusion for people new to React, and I believe part of that is due to minimization of the impact of the asynchronous behavior of `setState()` in the documentation. This revision is an attempt to clarify that behavior. For motivation and justification, see [setState Gate](https://medium.com/javascript-scene/setstate-gate-abc10a9b2d82).

* Update reference-react-component.md

* Signature fix

* Update to address @acdlite concerns

* Add more details
2017-06-12 16:33:38 -07:00
Gabriel Lett Viviani
4fd77b14b9 Fix the proptypes deprecation warning url on the "Don't Call PropTypes Warning" doc page (#9419)
* Use the same prop-types link on the warning docs page as the main proptypes doc page

* Link to repo instead
2017-06-12 16:33:38 -07:00
Dan Abramov
dea8f6a653 Use react-transition-group from npm (#9937) 2017-06-12 23:43:39 +01:00
Dan Abramov
3e7c17217e Delete .babelrc from addons (#9938) 2017-06-12 23:42:44 +01:00
Dan Abramov
beb370c102 Lint and test addons on CI (#9936)
* Lint addons

* Run prettier on addons

* Fix all lint issues

* Remove unused variable

* Test addons on CI
2017-06-12 21:26:56 +01:00
Michael Ridgway
61e8ee71b6 [#9627] Fix create-react-class isMounted ordering issue (#9638)
* [#9627] Fix create-react-class isMounted ordering issue

Split the IsMountedMixin in two so that the __isMounted flag is set to false after componentWillUnmount is executed in mixins and the component.

* Revert changes to integration test
2017-06-12 20:21:27 +01:00
Dan Abramov
088d593b0b Use Object.assign polyfill for update addon (#9932) 2017-06-12 19:46:08 +01:00
Dan Abramov
41e135e270 Remove broken GCC annotation from create-react-class (#9933) 2017-06-12 19:45:56 +01:00
Dan Abramov
871bd7e0c0 Delete prebuilt addon UMDs (#9931) 2017-06-12 19:33:35 +01:00
Flarnie Marchan
ce3ecfb1df [#9712] fix <input type="number" /> value '.98' should not be equal to '0.98'. (#9714) (#9929)
* [#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
2017-06-12 10:10:24 -07:00
Flarnie Marchan
3c898931ed Fix missing react dependency in some addon umd builds (#9919)
* Test 'create-react-class' with fixtures

NOTE: Never going to merge this commit, but I may cherry-pick it onto
branches in order to test fixes for issue #9765

**what is the change?:**
Require and use the UMD bundles of 'create-react-class' in three
fixtures to test the three supported uses;
 - test Global JS with globals.html
 - test AMD with requirejs.html
 - test CommonJS with webpack-alias

**why make this change?:**
To test https://github.com/facebook/react/pull/9761 and other PRs fixing https://github.com/facebook/react/issues/9765

**test plan:**
Manual testing;
 - cd into the directory in fixtures
 - run the build step if needed
 - open the file

**issue:**
https://github.com/facebook/react/issues/9765

* Rename fixtures testing create-react-class

**what is the change?:**
Renamed some fixtures.

**why make this change?:**
This is part of setting up manual tests of the add-ons we are fixing.

**test plan:**
`cd fixtures && node ./build-all.js` and manually open the renamed
fixtures.

**issue:**
https://github.com/facebook/react/issues/9765

* Prettify the unminified UMD build of `react-linked-input`

**what is the change?:**
`prettier addons/react-linked-input/react-linked-input.js | pbcopy` and
replaced the contents of the file.

**why make this change?:**
I am manually tweaking this file and want it to be more readable.

**test plan:**
about to set up manual testing of this with fixtures. I expect that
right now only the use of it as a global will work, and subsequent
commits will fix the AMD and CommonJS use cases.

**issue:**
https://github.com/facebook/react/issues/9765

* Test state of `react-linked-input` and `create-fragment` before fix

**what is the change?:**
Setting up the fixtures to enable manual testing of the
`react-linked-input` and `create-fragment` UMD builds.

This was a painstaking and frustrating process and we need something
better before making any more fixes to addons. Here is roughly what I
did;
- add 'console.log' statements to the add-on to confirm that you've loaded the right build case
- copy the add-on into 'build/packages' so that the 'webpack-alias' can find it.
- make copies of each of the following three fixtures for each add-on you want to test, renaming them to specify what you are testing:
	- globals.js
	- requirejs.js
	- webpack-alias/*
- modify those fixtures to use the add-on you intend to text

**why make this change?:**
We need to verify the current state of the bug before fixing it, to
confirm that the change actually is fixing the bug.

**test plan:**
`open fixtures/globals-with-create-react-fragment.html`
`open fixtures/globals-with-react-linked-input.html`
`open fixtures/requirejswith-create-react-fragment.html`
`open fixtures/requirejswith-react-linked-input.html`
`cd fixtures/webpack-aliaswith-create-react-fragment/ && yarn build && open index.html`
`cd fixtures/webpack-aliaswith-react-linked-input/ && yarn build && open index.html`

**issue:**
https://github.com/facebook/react/issues/9765

* Fix missing `React` in `react-linked-input` and `create-fragment`

**what is the change?:**
Manually tweaking the UMD builds for both add-ons to include a
dependency on React.

**why make this change?:**
They were broken before for AMD and CommonJS.
For reasons I have not debugged, the CommonJS builds are still broken,
but the AMD is now fixed and globals still work:

```
    do 'react-linked-input' and
    'create-react-fragment' work?

                before      after
              + my        + my        +
  en^ironment | fix       | fix       |
+----------------------------------------
              |           |           |
  Global JS   |  :) yes   |  :) yes   |
+----------------------------------------
              |           |           |
  AMD         |  X no     |  :) yes   |
+----------------------------------------
              |           |           |
  CommonJS    |  X no     |  X no     |
+-------------+-----------+-----------+--

```

**test plan:**
In the previous commit we set up fixtures to manually test these.

**issue:**
https://github.com/facebook/react/issues/9765

* More adjustments to enable testing with fixtures

Not worth explaining - just committing as a 'save point' while I fiddle
with the fixtures.

* Remove all cruft from manually testing addons in fixtures

**what is the change?:**
We forked three of the fixtures into two variations to test two of the
react addons. We also added `console.log` statements to the addons to
verify that we were loading the right build.

This commit cleans it up by
- deleting forked fixtures
- re-adding the original fixtures
- removing `console.log` statements

**why make this change?:**
To get this branch ready for review.

**test plan:**
`cd fixtures && node ./build-all.js` and then check the updated fixtures
manually

**issue:**
https://github.com/facebook/react/issues/9765

* Double to single quotes in 'react-linked-input'

**what is the change?:**
`:%s /"/'/gc`

I left double quotes wrapping cases where we have single quotes in the
string.

**why make this change?:**
I ran the code for the unminified 'react-linked-input' through
'prettier' so it would be easier for me to manually fix the UMD wrapper.
And 'prettier' changed many single quotes into double quotes. @spicyj
pointed out this will be treated differently by the google closure
compiler, and may have semantic differences.

**test plan:**
It's not worth testing imo.

**issue:**
https://github.com/facebook/react/issues/9765

* remove random newline
2017-06-12 08:43:08 -07:00
Mond WAN
ae89a74091 Fix missing react in create-react-class (#9761)
* Fix missing react in create-react-class

refs #9689

* Modify the 'create-react-class' package to make 'globals' work again

**what is the change?:**
Pass the global 'react' into the global conditional in the UMD build of
'create-react-class'.

**why make this change?:**
Here is the deal:
 - @mondwan's original fix does fix the AMD build, but breaks the
   'global JS' build.
 - My modification makes it work with both AMD and the 'global JS'
   build.
 - @mondwan's fix seems to have fixed the CommonJS build too, and I
   maintained that fix with my modification.

```
                Does the 'create-react-class' UMD build work?

                 Before       After         After
               + @mondwan's + @mondwan's +  @flarnie's
  Build System | fix        | fix        |  modification
+---------------------------------------------------------+
               |            |            |
  Global JS    | :D Success | X Fail     | :D Success
               |            |            |
+---------------------------------------------------------+
               |            |            |
  AMD          | X Fail     | :D Success | :D Success
               |            |            |
+---------------------------------------------------------+
               |            |            |
  Common JS    | X Fail     | :D Success | :D Success
               |            |            |
               +            +            +

```

**test plan:**
The testing for this was really tricky and involves a fragile multi-step
process:

1) Make sure the fixtures are working on your branch

2) Modify some of the fixtures to use 'create-react-class', like in this
   commit (you can just cherry-pick it if you are on a branch based on
   the 15.* branches) -
   51dcbd5ef1

3) Make sure React is set up, and then
   `cd fixures && node ./build-all.js`

4) The following fixtures could be used to test the various builds:
 - test GlobalJS with `globals.html`
 - test AMD with `requirejs.html`
 - test CommonJS with `webpack-alias/index.html`

**issue:**
https://github.com/facebook/react/issues/9689
and
https://github.com/facebook/react/issues/9765
2017-06-10 11:06:48 -07:00
Mond WAN
fc542d7f78 Fix missing react in create-react-class (#9761)
* Fix missing react in create-react-class

refs #9689

* Test 'create-react-class' with fixtures

NOTE: Never going to merge this commit, but I may cherry-pick it onto
branches in order to test fixes for issue #9765

In this case I will clean it up afterwards.

**what is the change?:**
Require and use the UMD bundles of 'create-react-class' in three
fixtures to test the three supported uses;
 - test Global JS with globals.html
 - test AMD with requirejs.html
 - test CommonJS with webpack-alias

**why make this change?:**
To test https://github.com/facebook/react/pull/9761 and other PRs fixing https://github.com/facebook/react/issues/9765

**test plan:**
Manual testing;
 - cd into the directory in fixtures
 - run the build step if needed
 - open the file

**issue:**
https://github.com/facebook/react/issues/9765

* Remove fiber specific fixures

This already was merged (https://github.com/facebook/react/pull/9902)
but I wanted to do manual testing and needed the change locally.

**what is the change?:**
Remove 'fiber-debugger', 'fiber-triangle', and 'packaging' from
'fixtures' directory.

**why make this change?:**
These were not meant to be included on this branch and cause the
'build-all.js' script to throw.

**test plan:**
`cd ./fixtures && node ./build-all.js`

* Modify the 'create-react-class' package to make 'globals' work again

**what is the change?:**
Pass the global 'react' into the global conditional in the UMD build of
'create-react-class'.

**why make this change?:**
Here is the deal:
 - @mondwan's original fix does fix the AMD build, but breaks the
   'global JS' build.
 - My modification makes it work with both AMD and the 'global JS'
   build.
 - @mondwan's fix seems to have fixed the CommonJS build too, and I
   maintained that fix with my modification.

```
                Does the 'create-react-class' UMD build work?

                 Before       After         After
               + @mondwan's + @mondwan's +  @flarnie's
  Build System | fix        | fix        |  modification
+---------------------------------------------------------+
               |            |            |
  Global JS    | :D Success | X Fail     | :D Success
               |            |            |
+---------------------------------------------------------+
               |            |            |
  AMD          | X Fail     | :D Success | :D Success
               |            |            |
+---------------------------------------------------------+
               |            |            |
  Common JS    | X Fail     | :D Success | :D Success
               |            |            |
               +            +            +

```

**test plan:**
The testing for this was really tricky and involves a fragile multi-step
process:

1) Make sure the fixtures are working on your branch

2) Modify some of the fixtures to use 'create-react-class', like in this
   commit (you can just cherry-pick it if you are on a branch based on
   the 15.* branches) -
   51dcbd5ef1

3) Make sure React is set up, and then
   `cd fixures && node ./build-all.js`

4) The following fixtures could be used to test the various builds:
 - test GlobalJS with `globals.html`
 - test AMD with `requirejs.html`
 - test CommonJS with `webpack-alias/index.html`

**issue:**
https://github.com/facebook/react/issues/9689
and
https://github.com/facebook/react/issues/9765

* Undo modifications that add 'create-react-class' to fixtures

**what is the change?:**
In the previous commit we modified the fixtures to test
'create-react-class' manually, and this puts them all back.

**why make this change?:**
This will be useful for cherry-picking onto branches where we used the
previous commit for testing purposes

**test plan:**
`cd fixtures && node ./build-all.js` and open the fixtures

* remove stray console.log
2017-06-10 10:32:49 -07:00
Dan Abramov
ddae1cd39f Fix doc styling and formatting issues 2017-06-10 00:05:23 +01:00
Danilo Vitoriano
874a8ecc58 Move Past Confs, add React Conf Brazil 2017 (#9697)
* move past confs, add React Conf Brazil 2017

* move react europe to past confs

* resolve react europe conflicts

* Create conferences.md
2017-06-09 23:21:42 +01:00
Mario Souto
2421bc6e73 Remove extra brace (#9910) 2017-06-09 23:21:12 +01:00
Victoria Quirante
fd752538a5 Adding React Alicante 2017 to upcoming conferences (#9897) 2017-06-09 23:20:34 +01:00
Kurt Furbush
98ae5aaf96 Update reference-react-component.md (#9863)
Grammatical edit to match same statement in state-and-lifecycle.html
2017-06-09 23:20:04 +01:00
Garmash Nikolay
105b95bf17 Fix url to ng-animate (#9859) 2017-06-09 23:19:35 +01:00
Fernando Montoya
414deb16ce Update webpack according to brand guidelines (#9595)
* Update webpack according to brand guidelines

* Change all ocurrences to webpack
2017-06-09 23:19:09 +01:00
Ricardo
1ded80debd Insert blockquote on prop value explanation. (#9770)
While reading the page, the "chain of thought" is broken by stating that the `tempertature` and `onTemperatureChange` don't have any special meaning. Making this a blockquote makes that note look more like a comment and keep the "chain of thought" intact.
2017-06-09 23:18:48 +01:00
cjshawMIT
4974989003 Clarifying how to apply aria-* attributes (#9843)
Provide explicit example of what "keep lowercase" means for `aria-*` attributes.
2017-06-09 23:18:16 +01:00
Lipis
e46dc02e7d Rename Javascript to JavaScript (#9796) 2017-06-09 23:17:20 +01:00
Lipis
597b14579e Rename Github to GitHub (#9797)
(cherry picked from commit 07d229b28e)
2017-06-09 23:04:14 +01:00
Erik Hellman
b51cd8ff12 Add Videos link to React Europe 2017 (#9751)
(cherry picked from commit d30bc9807e)
2017-06-09 23:03:02 +01:00
Flarnie Marchan
d5c3afda2f Add 'Test Utils' docs back to main navigation (#9676)
* Add 'Test Utils' docs back to main navigation

**why make this change?:**
We accidentally removed this - still supporting the use of Test Utilities, so we should have them in the docs.

**test plan:**
Manually tested the website - will insert a screenshot.

**issue:**
https://github.com/facebook/react/issues/9651

* Move test-utils docs to reference section

**what is the change?:**
Moved from 'advanced guides' to 'reference'

**why make this change?:**
It makes more sense as a reference

**test plan:**
Visual inspection (flarnie may add a screenshot)

**issue:**

* Add back the shallow renderer docs and remove outdated docs

**what is the change?:**
- Remove outdated 'shallow renderer' docs on 'test utils' page, and point to the updated 'shallow renderer' docs.
- Re-add a link to the updated 'shallow renderer' docs on the main navigation.

**why make this change?:**
This was already approved in https://github.com/facebook/react/pull/9331 which was then cherry-picked to https://github.com/facebook/react/pull/9359/commits and landed on master.

I'm not sure why some of these changes didn't persist. For now just adding back the changes we need.

**test plan:**
Manually inspected website - will insert screenshots.

**issue:**

* Further improvements to 'shallow rendering' and 'test utils' docs

Thanks @gaearon for the improvements!

**what is the change?:**
- Remove <hr/> from end of 'shallow rendering' docs
- 'documents' -> 'documentation'
- Move 'shallow rendering' redirection section to top of 'test utils' docs
- Add intro sentence about testing to 'shallow rendering' docs

**why make this change?:**
Documentation helps people learn.

**test plan:**
Visual inspection

(cherry picked from commit 114b9c5500)
2017-06-09 23:03:01 +01:00
Will Myers
f78299469f Update blog post which creates unhandled promise rejection (#9668)
* Update 2015-12-16-ismounted-antipattern.md

In case anybody else stumbles across this old blog post, I wanted to submit a patch to help with unhandled rejections.

`#then` and `#catch` each return new Promise instances, so here we actually create two new promises (that aren't assigned).  If the argument promise to `#makeCancelable` rejects, the promise created by `#then` will be an unhandled rejection, which in Node 7 will be an uncaught error.

By using the second argument of `#then` to handle rejections instead, we don't need to worry about the runtime finding any unhandled rejections here.

* Style updates

* Add update notice

(cherry picked from commit 546e7721ec)
2017-06-09 23:03:01 +01:00
Max Donchenko
f1c449ff1d Fix typo (#9786)
(cherry picked from commit 43f2ea079c)
2017-06-09 23:03:01 +01:00
Danny Hurlburt
f593e98201 Bind handleChange Instead of Calling (#9764)
(cherry picked from commit 1f667fd37f)
2017-06-09 23:03:00 +01:00
Samuel Hapák
3d019b3cc7 Add ReactiveConf (#9723)
(cherry picked from commit 1f80931d32)
2017-06-09 23:03:00 +01:00
Erik Hellman
242565f232 Move ReactEurope 2017 from Upcoming Conferences to Past Conferences (#9726)
(cherry picked from commit 5b7e81579d)
2017-06-09 23:03:00 +01:00
Hikaru Suido
ad3a6cb067 Move previous events to the end (#9729)
(cherry picked from commit 3d6d641a8c)
2017-06-09 23:02:59 +01:00
Dave Lunny
518de2edb5 "Timeline" => "Performance" (#9602)
As of Chrome 58, the Timeline tab is now called the Performance tab, this updates the "Optimizing Performance > Profiling Components with Chrome Performance" section of the docs to reflect that.
(cherry picked from commit 5cf571839e)
2017-06-09 23:02:59 +01:00
shifengchen
a08035b003 Edit two errors in docs (#9659)
(cherry picked from commit d7e6ef0f88)
2017-06-09 23:02:59 +01:00
Flarnie Marchan
b02bbfebe7 Remove fiber-specific fixtures from 15.6 branch (#9902)
* Remove fixtures that only work with Fiber

**what is the change?:**
Removes three directories in the 'fixtures' directory.

**why make this change?:**
These fixtures were designed to work with Fiber, and were accidentally
pulled into this branch. They were causing errors when we try to build
the other fixtures.

**test plan:**
`cd react/fixtures && node ./build-all.js` no longer throws an error
from `fiber-debugger/App.js` - although it still throws another error

**issue:**
https://github.com/facebook/react/issues/9900

* Add back the 'babel-standalone' fixture

**what is the change?:**
Add this fixture back to the 15.6 branch

**why make this change?:**
This fixture is not fiber specific

**test plan:**
`node ./build-all.js` inside of ./fixtures

**issue:**
https://github.com/facebook/react/issues/9900
2017-06-09 13:05:24 -07:00
Flarnie Marchan
63795005d3 Remove fiber-specific fixtures from 15.6 branch (#9902)
* Remove fixtures that only work with Fiber

**what is the change?:**
Removes three directories in the 'fixtures' directory.

**why make this change?:**
These fixtures were designed to work with Fiber, and were accidentally
pulled into this branch. They were causing errors when we try to build
the other fixtures.

**test plan:**
`cd react/fixtures && node ./build-all.js` no longer throws an error
from `fiber-debugger/App.js` - although it still throws another error

**issue:**
https://github.com/facebook/react/issues/9900

* Add back the 'babel-standalone' fixture

**what is the change?:**
Add this fixture back to the 15.6 branch

**why make this change?:**
This fixture is not fiber specific

**test plan:**
`node ./build-all.js` inside of ./fixtures

**issue:**
https://github.com/facebook/react/issues/9900
2017-06-08 17:23:28 -07:00
Flarnie Marchan
e5b3554edc Add 'create-react-class' to react dependencies for build (#9847)
**what is the change?:**
We needed this dependency in the package.json

**why make this change?:**
Even though `create-react-class` was added as a dependency to the
`package.json` in https://github.com/facebook/react/pull/9399/files we
didn't completely cherry-pick this change onto 15.6 from master in b48b2594fa

This fixes that omission.
Following this fix we will review PR 9399 and make sure nothing else was
missed.

**test plan:**
`yarn build` and inspect the `builds/packages/react/package.json`, see
that `create-react-class` is included.

**issue:**
https://github.com/facebook/react/issues/9830
2017-06-04 18:08:15 -07:00
Flarnie Marchan
fe031caf69 Hello 15.6 Release Candidate (#9828)
* Hello 15.6 Release Candidate

**what is the change?:**
We update the versions of all associated React packages when bumping the
version of React.

**why make this change?:**
We want to publish a RC to give folks time to try out the latest version
before it's final.

Why bump the version of every other associated package?

It makes the dependency between them more clear.

There will be cases where we make a fix in React-DOM and it requires
changes in React core. In that case, it will be more clear to people
when we update the versions of both and they remain in sync.

**test plan:**
Visual inspection

**issue:**
https://github.com/facebook/react/issues/9398

* Update a couple more packages versions

**what is the change?:**
Updates version for 'react-dom-factories' package and 'react-addons'
template.

**why make this change?:**
We missed these in the previous commit, which was copying the approach
from https://github.com/facebook/react/pull/9828/files

**test plan:**
Visual inspection, and running the build

**issue:**
https://github.com/facebook/react/issues/9398
2017-06-01 10:34:01 -07:00
Flarnie Marchan
78fc25f251 Prepare react-dom-factories for publishing (#9823)
* Prepare `react-dom-factories` for publishing

**what is the change?:**
- copies the `React.DOM.*` factory helpers into the package and wraps
  them with an IIFE
- set peerDependency on React to latest 15 version

**why make this change?:**
We are deprecating `React.DOM.*` and this provides a fallback option for
those using it.

We just copied the code in order to avoid a circular dependency, which
keeps complexity down since we are supporting every possible build
system.

**test plan:**
TODO -
1. Copy this into one of our fixtures using a UMD/AMD build and see if
   it works there.
2. Do an initial publish of the package on npm and then pull it into
   CRA, and try it there.
3. Try it in https://github.com/duncanbeevers/jade-react or some other
   project that actually uses the `React.DOM.*` helpers, using the
   related codemod.

**issue:**
https://github.com/facebook/react/issues/9398

* Fix lints and capitalization of 'reactDOMFactories'

**what is the change?:**
Fixing nits in capitalization, quotes, and defined globals

**why make this change?:**
To get CI passing, consistency, correctness

**test plan:**
see prev. commit

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-31 16:04:16 -07:00
Nathan Hunzaker
f93324496f Inputs should not mutate value on type conversion (#9806)
This is a follow-up on
https://github.com/facebook/react/pull/9584#discussion_r115642293. There
is no need to assign the value property of an input if the value
property of the React component changes types, but stringifies to the
same value. For example:

```javascript
DOM.render(<input value="true" />, el)
DOM.render(<input value={true} />, el)
```

In this case, the assignment to `input.value` will always be
cast to the string "true". There is no need to perform this
assignment. Particularly when we already cast the value to a string
later:

```javascript
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
```
2017-05-30 13:30:28 -07:00
Flarnie Marchan
98fde611ef Improve warning for React.createClass (#9781)
* Improve warning for `React.createClass`

**what is the change?:**
- Explain that this will be removed in v16.0 specifically
- Mention the version number for the drop-in replacement module.
- Link to docs in the blog post about how to migrate

**why make this change?:**
We want to make our deprecation warnings more clear and helpful.

**test plan:**
Visual inspection and `yarn test`

**issue:**
https://github.com/facebook/react/issues/9398

* Widen range of recommended replacement module versions

**what is the change?:**
Instead of recommending specific versions of 'prop-types' and
'create-react-class' we ask folks to use the latest available 15.* version.

**why make this change?:**
The latest version of those plugins, within the 15 version, is the most likely
to be stable. For example, we know that 'react-create-class' is broken for AMD
builds at the current latest version, so once we release a fix then the
recommended version will change.

**test plan:**
Visual inspection
Also fixed some tests.

* Fix typos and things

**what is the change?:**
- `migrade` -> `migrate`
- `15.* prop-types package` -> `v15.* prop-types package`

**why make this change?:**
Correctness

**test plan:**
`yarn test` and visual inspection
2017-05-30 13:25:41 -07:00
Dan Abramov
b34a312e6c Remove PropTypes dependency from ReactLink (#9766)
It doesn't seem to be used. It was probably used by internal FB consumers of ReactLink which has long been removed.
2017-05-26 23:21:50 +01:00
Flarnie Marchan
6086a22482 react-addons-dom-factories (#9780)
**what is the change?:**
`grep -r "react-addons-dom-factories" ./src` and the same in `./packages`
then `%s /react-addons-dom-factories/react-dom-factories/gc`

**why make this change?:**
React dom factories were never part of the 'addons' and we want to minimize the
whole 'addons' thing, since we are deprecating the `React.addons.*` API.

**test plan:**
`yarn test`
and manually look at the README that was updated.

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-25 16:01:23 -07:00
Flarnie Marchan
b43f830101 Remove random comment in react-dom-factories README
Remove a comment saying `es6`, since this is potentially unclear. We aren't
contrasting to an es5 example here.

Thanks to @gaearon for catching this in review of
https://github.com/facebook/react/pull/9780
2017-05-25 15:18:45 -07:00
Flarnie Marchan
b48b2594fa Cherrypick warning and removal of react create class (#9771)
* react-create-class -> create-react-class

* Fix issues/bugs introduced by merge conflict resolution

**what is the change?:**
A couple of bugs and holes were introduced when cherry-picking https://github.com/facebook/react/pull/9232 onto the 15.6 branch. This fixes them.
We also needed to add some logic from https://github.com/facebook/react/pull/9399

**why make this change?:**
To keep tests passing and get this change working.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/9398

* Move component base classes into a single file (#8918)

* More fixes for issues introduced by rebasing

**what is the change?:**
- Remove some outdated 'require' statements that got orphaned in 'React.js'
- Change 'warning' to 'lowPriorityWarning' for 'React.createClass'
- Fix syntax issues in 'React-test'
- Use 'creatReactClass' instead of ES6 class in ReactART
- Update 'prop-type' dependency to use no higher than 15.7 because 15.8 limits the number of warnings, and this causes a test to fail.
- Fix some mixed-up and misnamed variables in `React.js`
- Rebase onto commit that updates deprecation messages
- Update a test based on new deprecation messages

**why make this change?:**
These were bugs introduced by rebasing and tests caught the regressions.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/9398

* Reset `yarn.lock`

**what is the change?:**
I didn't mean to commit changes to `yarn.lock` except for the `prop-types` and `create-react-class` updates.

**why make this change?:**
To minimize the changes we make to dependency versions.

**test plan:**
`rm -rf node_modules`
`yarn install`
`yarn run build`
`yarn test`

* Run `yarn prettier`
2017-05-25 15:12:17 -07:00
Flarnie Marchan
3f62cd557f Improve deprecation warnings by more info and links (#9768)
* Improve deprecation warnings by more info and links

**what is the change?:**
Updates the warnings for -
 - `React.createMixin` (was never implemented!)
 - `React.PropTypes`
 - `React.createClass`
 - `React.DOM.*`

We never added the warning for `React.createClass` to the 15.5 line, so
a follow-up PR will add that, with a link to docs etc.

Does *not* update the older warnings for -
 - Factory.type
 - 'isMounted' and 'replaceState'
 - ReactPerf

We could do a second pass if we want to improve those three warnings, but for now I don't think they are as hi-pri.

Still TODO:
 - Do an initial release of the [`react-addons-dom-factories`](https://github.com/facebook/react/tree/master/packages/react-dom-factories#react-addons-dom-factories) package on npm, making it 1.0.
 - Improve the docs for `react-addons-dom-factories` adding documentation and mention the [codemod](https://github.com/reactjs/react-codemod/blob/master/transforms/React-DOM-to-react-dom-factories.js)

**why make this change?:**
 - We want to make updating as easy as possible. Warning messages should increase clarity, and in the past they have caused confusion.

**test plan:**
`yarn test` and running these messages past some folks who use React.

**issue:**
https://github.com/facebook/react/issues/9398

* Rephrase deprecation messages for clarity

**what is the change?:**
We rephrased the deprecation messages to clarify that
 - these APIs are currently deprecated
 - they will be removed in React v16.0

The previous wording implied that they would be deprecated in v16.0.

**why make this change?:**
To make the messages easier to understand.

**test plan:**
Visual inspection
2017-05-25 07:22:54 -07:00
Flarnie Marchan
16a62c248b Improve low priority warning (#9754)
* Add back caught error and other checks to 'lowPriorityWarning'

**what is the change?:**
This change makes 'lowPriorityWarning' an exact copy of 'warning.js' from
e66ba20ad5/packages/fbjs/src/__forks__/warning.js
where before we had skipped some checks from that module.

- Adds an error which we catch, in order to let people find the error and resulting stack trace when using devtools with 'pause on caught errors' checked.
- Adds check that 'format' argument is passed

**why make this change?:**
- To maintain a closer fork to 'warning.js'
- To allow easier debugging using 'pause on caught errors'
- To validate inputs to 'lowPriorityWarning'

**test plan:**
`yarn test`
2017-05-24 08:25:30 -07:00
Flarnie Marchan
d97317e806 Remove stray reference to React.PropTypes in ReactLink (#9757)
**what is the change?:**
It looks like we missed updating this callsite in 12a96b9482

**why make this change?:**
We are deprecating the `React.PropTypes` syntax and splitting that functionality into [a separate module](12a96b9482).
@acdlite please correct me if there is a reason we left this here.

**test plan:**
`yarn test`

**issue:**
https://github.com/facebook/react/issues/9755
2017-05-23 18:39:17 -07:00
Flarnie Marchan
413c7b548a Cherrypick commit to downgrade deprecations to warnings (#9753)
* Downgrade deprecation warnings from errors to warnings (#9650)

* Downgrade deprecation warnings from errors to warnings

**what is the change?:**
Swapping out `warning` module for a fork that uses `console.warn`.
It looks like we were using the `warning` module for deprecation notices, *but* there is also a 'deprecated' module designed specifically for deprecation notices.

However, we could not find any place that it was currently used.

Since React's build process is not 100% clear to me, I assume it could still be used somewhere by something and just updated it along with other deprecation notices.

We might consider a follow-up diff that does some clean up here;
 - remove 'deprecated' module if it's unused, OR
 - use 'deprecated' module for all our current deprecation warnings

**why make this change?:**
- We have had complaints about noisy warnings, in particular after introducing new deprecations
- They potentially cause CI failures
- Deprecations are not really time-sensitive, can ship without breaking your app, etc.

For more context - https://github.com/facebook/react/issues/9395

**test plan:**
`npm run test`
and unit tests for the new modules
and manual testing (WIP)

**issue:**
https://github.com/facebook/react/issues/9395

* Add 'lowPriorityWarning' to ReactExternals

**what is the change?:**
We won't bundle 'lowPriorityWarning' with the rest of React when building for Facebook.
NOTE: A parallel commit will introduce an internal implementation of 'lowPriorityWarning' in Facebook's codebase, to compensate. Will post a comment with the diff number once that is up.

**why make this change?:**
So that the sync between github and Facebook can go more smoothly!

**test plan:**
We will see when I run the sync! But this is a reasonable first step imo.

**issue:**
https://github.com/facebook/react/issues/9398

* Tweaks to get tests passing after cherry-picking PR#9650

**what is the change?:**
- adds 'lowPriorityWarning' for deprecation of '__spread' and 'createMixin'
- tweaks test to check for 'warn' and not 'error'

**why make this change?:**
Both these issues were introduced by merge conflict resolution when cherry-picking this change from master onto 15.6.

**test plan:**
`yarn test`

**issue:**

* Fix mis-written 'require' for 'warning' module

**what is the change?:**
Fixes 'warning' to be required from 'warning'

**why make this change?:**
It was causing the browserify build to crash, because we don't expect to have a path to 'warning'.

**test plan:**
CI
2017-05-23 15:11:51 -07:00
Flarnie Marchan
1d7971a85a Run prettier 2017-05-20 11:19:21 -07:00
Jason Quense
68347c9985 Backport input fix (#8575)
* Only fire input value change events when the value changes (#5746)

* Allow simulated native events to propagate

fixes #7211 fixes #6822 fixes #6614

we should make sure it doesn't break #3926 any worse (or works with #8438)
2017-05-20 11:15:12 -07:00
Dan Abramov
cde14be002 New blog post: What's New in Create React App (#9719) 2017-05-19 05:31:59 +01:00
Dan Abramov
5c415d1e64 Provide non-standard stack with invalid type warnings (#9679)
* Provide non-standard stack with invalid type warnings

* Include parent stack but mark owner chain as pertinent

* Just parent stack is enough for my needs

Because to avoid noise it is enough to collapse too close frames in the UI.

* functionName => name

* Hide behind a feature flag
2017-05-15 20:39:39 +01:00
Carolina Powers
5c25cda519 Fix typo on tutorial.md. (#9644)
The absence of the word `this` will cause CodePen
to scream at you. This fix should avoid that.
(cherry picked from commit 7c1e971e7f)
2017-05-10 08:24:32 +01:00
Dan Abramov
28bef90a86 react-addons-create-fragment@15.5.4 2017-05-10 00:59:02 +01:00
Dan Abramov
0b48a3e8e1 create-react-class@15.5.3 2017-05-10 00:58:26 +01:00
Michael Ridgway
0d74dfb317 Add browserify transform (#9642)
* Add loose-envify browserify transform

* Add transform to react-addons-create-fragment
2017-05-10 00:52:32 +01:00
Michael Ridgway
2bbe02456b Add browserify transform (#9642)
* Add loose-envify browserify transform

* Add transform to react-addons-create-fragment
2017-05-10 00:49:58 +01:00
Flarnie Marchan
4f7136e1d7 Minor tweak to adjust ReactDOM-test for #8356
**what is the change?:**
Changed a test to look for the warning we added in https://github.com/facebook/react/pull/8356/files

**why make this change?:**
To update our tests for new behavior.

**test plan:**
`npm run test`

**issue:**
https://github.com/facebook/react/issues/9398
2017-05-09 14:27:48 +01:00
Nathan Hunzaker
0001036d35 Move ReactDOMFactories into separate package (#8356)
- Update examples to no longer use React.DOM
- Add package and documentation entries for react-addons-dom-factories
- Update dom-factories readme
- Set up proxy to intercept React.DOM usage
- Update ReactDOM children tests to use createElement
- Add more specific warning assertion for React DOM factories
- Do not use expectDev in ReactDOMFactories tests
2017-05-09 13:51:22 +01:00
Flarnie Marchan
850231c6da Remove tests which use dependency that is missing in 15.6
**what is the change?:**
Removed some tests which were added in e29871e6be

**why make this change?:**
These tests use `inputValueTracking`, which was only added on the master branch and has not yet been added to the 15.* branch.
[There is a PR out](https://github.com/facebook/react/pull/8575) to add this and related bug fixes to the 15.* branch, but there are some unresolved issues there. We plan to follow up on this after releasing 15.6.
For now, we are removing these to unblock releasing 15.6.

**test plan:**
`npm run test`

**issue:**
https://github.com/facebook/react/issues/9410
2017-05-09 13:51:21 +01:00
Dan Abramov
07f57661f0 Fix horizontal scrolling in docs (#9613)
(cherry picked from commit 6facb85f85)
2017-05-05 18:05:45 +01:00
Dan Abramov
c9864556e9 Fix sequencing in the Tutorial (#9615)
* Fix sequencing in the Tutorial

* Update tutorial.md

* Update tutorial.md

(cherry picked from commit 138ff5e46b)
2017-05-05 18:05:45 +01:00
Dan Abramov
d2be47b8c4 Tweak Tutorial based on feedback 2017-05-04 00:30:27 +01:00
Nathan Hunzaker
e29871e6be Remove loose check on non-number controlled inputs. Fix trailing dot issue. (#9584)
* Remove loose check when assigning non-number inputs

This commit removes a check I added when working on number input
issues where we perform a loose check on an input's value before we
assign it. This prevented controlled text inputs from disallowing
numeric text entry.

I also added a DOM fixture text case.

Related issues:

https://github.com/facebook/react/issues/9561#issuecomment-298394312

* Use strict equality as a guard before assigning input.value

This commit adds back the guard around assigning the value property to
an input, however it does it using a strict equals. This prevents
validated inputs, like emails and urls from losing the cursor
position.

It also adds associated test fixtures.

* Add copy command after build for interup with surge.sh
2017-05-03 11:45:52 -07:00
Brandon Dail
115452f87e Use setProperty when setting style properties (#9302)
* Use setProperty when setting style properties

setProperty is faster in all/most modern browsers. It also lets us support CSS variables.

* Only use setProperty when setting CSS variables

* Add test to ensure setting CSS variables do not warn

* Make this PR pretty again

* Run fiber test script
2017-05-03 11:04:25 -07:00
Dan Abramov
e084900e5c Bump docs version 2017-05-03 15:41:31 +01:00
Dan Abramov
d34eba0b33 Fix mobile layout 2017-05-03 15:39:11 +01:00
Dan Abramov
aba76bf4ff Fix a typo 2017-05-03 15:05:02 +01:00
Dan Abramov
ee1a400a8f Use a more specific link 2017-05-03 11:05:34 +01:00
Addy Osmani
6052d7b455 Add DEV mode note to installation doc (#8784) (#9157)
* Add DEV mode note to installation doc (#8784)

* Address feedback from Dan on wording

(cherry picked from commit f86256ece0)
2017-05-03 11:05:18 +01:00
Dan Abramov
ea5f8cdb03 Add more info about building for production (#9592)
* Add more info about building for production

* Add more info to the docs

(cherry picked from commit 185db64c76)
2017-05-03 11:05:18 +01:00
Joe Critchley
a32974a2b0 [Docs] Show the name 'React' first in the homepage's <title> (#9582)
(cherry picked from commit 109d1c95e3)
2017-05-03 11:05:17 +01:00
Frankie Bagnardi
aa1570cf35 [Tutorial] Make it easier to follow the instructions (#9454)
* tutorial: adds note about onClick

* tutorial: show full square component

* merge

* fixes line number

* tutorial: misc changes

* fixes Board render initial code sample

* [tutorial] adds codepen links and misc small fixes

* removes useless arrow functions, #9531

* {this.renderSquare} new lines

* be more explicit about history state

* fixes highlight

* following along locally

* changes todo to this.props.value

* removes calculateWinner from initial codepens and includes it in tutorial

* removes note about calculateWinner at end of file

* adds debug-view and debug-view-final

* removes debug view, updates codepen instructions

* adds another codepen

* tutorial.md

* tutorial.md

* tutorial.md

* tutorial.md

* Put . into links for consistency with docs

* Make the very first change easier to follow

* A few more changes

(cherry picked from commit e9d6f3f10e)
2017-05-01 17:23:27 +01:00
Marcos Ojeda
295b733ab2 docs better indicate that state updaters shallowly merge with state (#9554)
this was a surprise to me because the docs seemed to indicate that when
using an updater, the result _needed_ to be a new state object. I was
[not alone](https://twitter.com/ken_wheeler/status/857939690191806464)
i think in discovering this as a result of the previous tweet in the
thread.
(cherry picked from commit f737d63302)
2017-05-01 17:23:27 +01:00
Sriram Thiagarajan
08234e7b32 pre format only compile time errors (#9538)
* pre format only compile time errors

* Style tweak

(cherry picked from commit 70c01963d9)
2017-05-01 17:23:27 +01:00
Paul O’Shannessy
eaadfb856d Don't build gh-pages branch on CircleCI (#9442) 2017-04-26 21:28:00 +01:00
wacii
961fe7310f Add guide on integrating with non-react code (#9316)
* Add guide on integrating with non-react code

* Capitalize guide title

* Make links to other docs relative

* Rephrase 'What it does do'

* Remove experimental syntax

* Capitalize Backbone

* Remove empty lifecycle method in generic jQuery example

* Use shouldComponentUpdate() not componentWillUpdate()

* Prefer single quotes

* Add cleanup to generic jQuery example

* Capitalize React

* Generalize the section on Backbone Views

* Generalize the section on Backbone Models, a little

* Add introduction

* Adjust wording

* Simplify ref callbacks

* Fix typo in generic jQuery example

* Fix typos in Backbone models in React components

* Fix more typos in Backbone models in React components

* Add generic section on integrating with other view libraries

* Stress the benefits of an unchanging React element

* Small changes to introduction

* Add missing semicolon

* Revise generic jQuery wrapper section

Moved the section on using empty elements to prevent conflicts above the
code example and added brief introduction to that example.

* Add usage example for Chosen wrapper

* Prevent Chosen wrapper from updating

* Note that sharing the DOM with plugins is not recommended

* Mention how React is used at Facebook

* Mention React event system in template rendering section

* Remove destructuring from function parameters

* Do not name React components Component

* Elaborate on unmountComponentAtNode()

* Mention preference for unidirectional data flow

* Rename backboneModelAdapter

* Replace rest syntax

* Respond to updated model in connectToBackboneModel

* Rewrite connectToBackboneModel example

* Rework connectToBackboneModel example

* Misc changes

* Misc changes

* Change wording

* Tweak some parts

(cherry picked from commit 1816d06d6b)
2017-04-26 17:32:12 +01:00
RSG
5bb1ad113e React.createElement syntax (#9459)
* React.createElement syntax

Added React.createElement syntax.
I think this is required for this tutorial.

* Reword

(cherry picked from commit 9824d52a4c)
2017-04-26 17:32:12 +01:00
Sriram Thiagarajan
e38445d04a fixed error formatting in live editor (#9497)
(cherry picked from commit 7ccfb07337)
2017-04-26 17:32:12 +01:00
Daniel Lo Nigro
be4f0c2f41 [site] Load libraries from unpkg (#9499)
* [site] Load libraries from unpkg

* Revert Gemfile changes

(cherry picked from commit cf24d87177)
2017-04-26 17:29:03 +01:00
chocolateboy
a30937f6f6 [Docs] Fix confusing description for the <script>...</script> usage (#9502)
* Fix confusing description for the <script>...</script> usage

* Update jsx-in-depth.md

* Update reference-react-dom-server.md

* Update reference-react-dom.md

* Update reference-react.md

(cherry picked from commit 3d60d4cc7d)
2017-04-26 17:28:39 +01:00
Dmitri Zaitsev
8b48a394ea Add reference to the Hyperscript libraries (#9517)
* Add reference to the Hyperscript libraries

I feel these should be mentioned as they provide terser syntax than using `R.createElement` directly, even with a shorthand.

* Rephrase

(cherry picked from commit a8c223ab41)
2017-04-26 17:28:39 +01:00
Frankie Bagnardi
4a230dc75e adds indirect refs to docs (#9528)
* adds indirect refs to docs

* Add more info

* Explain clearer

* Rephrase

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

(cherry picked from commit 14fa8a5452)
2017-04-26 17:28:39 +01:00
Maciej Kasprzyk
fd3830453f Describe fixtures dir in the codebase overview (#9516)
* Describe fixtures dir in overview

* Fix folder name

(cherry picked from commit d12c41c7a6)
2017-04-26 17:28:39 +01:00
Jen Wong
ac1a4665e2 Updates how-to-contribute.md to use JSFiddle referenced in submit Git issue template (#9503)
(cherry picked from commit c8a64e2637)
2017-04-26 17:28:39 +01:00
Flarnie Marchan
928609d128 Add link to 'Typechecking with PropTypes' under 'Advanced Guides' (#9472)
This should have been retained in our docs, since PropTypes are only
moved and not deprecated.

Partially handles #9467, and I'll make a separate PR to
https://github.com/reactjs/prop-types to add more docs to the README
there.
(cherry picked from commit 39ca8aacf8)
2017-04-26 17:28:38 +01:00
David Hu
451a3aa2f7 Add more details in jsx-in-depth.md (#9006)
* jsx-in-depth.md add ternary statement for javascript expressions section

* jsx-in-depth.md add explanation to get falsey values for props

* update jsx-in-depth.md

* ensure links work locally, remove section about falsey prop values

* Fix links
2017-04-26 17:27:51 +01:00
Flarnie Marchan
009c9f7201 Update tests to not warn due to moved PropTypes and shallowRenderer (#9486)
* Update tests to not warn due to moved PropTypes and shallowRenderer

We added some warnings in v15.5 for calling `React.PropTypes` and
calling the shallow renderer from the wrong place. These warnings were
causing test failures, and now they are fixed.

Most of these were for the `React.PropTypes` change.

* tweak from running prettier

* Final tweaks to get tests passing

**what is the change?:**
Updated 'PropTypes' and 'shallow renderer' syntax in a couple more
places to get tests passing.

**why make this change?:**
In order to verify any changes to the 15.6 and 15.* branches in general
we should have tests passing.

**test plan:**
`npm run test`

**issue:**
https://github.com/facebook/react/issues/9410
2017-04-24 18:48:20 -07:00
Flarnie Marchan
ad1d3526f5 Run 'prettier' on the v15.6 branch (#9487)
* Run 'prettier' on the v15.6 branch

This is an easy fix and I'd like this branch to be as similar to master
(v16.0) as possible.

* `npm install --save-dev prettier && yarn prettier`

Checking in the updated `package.json` and `yarn.lock` for the 15.6
branch.

Oddly, running `yarn prettier` updated more files. I thought the
previous commit had covered all `prettier` syntax updates. Will commit
the new changes in a separate commit.

* Ran prettier

More syntax updates to get `prettier` checks passing on the `15.6-dev`
branch, and eventually, on 15-stable.

* Tweak eslint ignore comments to get linter passing

Something with running `prettier` moves or changes these comments in a
way that they were no longer being applied. We tweaked them so that both
'prettier' and 'eslint' pass.
2017-04-22 11:36:25 -07:00
Flarnie Marchan
1926f9ab06 Quick fix for flowconfig
We had a merge conflict sneak in somewhere, and also want to ignore the
'addons' directory.
2017-04-21 13:03:01 -07:00
Chris Pearce
a6b51ed8fb Only attempt to clear measures if we created the measure (#9451)
This fixes an issue where if we decided not to create a measurement we would clear ALL measurements from the performance entry buffer due to passing `undefined` as the entry name.
2017-04-20 11:26:25 -07:00
Eric Sakmar
25177ec4ea Adds CSS Grid properties to list of unitless numbers (#9185) 2017-04-20 11:21:14 -07:00
Almero Steyn
2a5aaccd7a [Docs: Installation] Fix tabs responsive layout - Resubmit (#9458)
* [Docs: Installation] Fix tabs responsive layout

* Move tabs a pixel down

* Remove left margin on first tab

* Remove the long line

* Fix mobile styles

(cherry picked from commit a92128e7fb)
2017-04-20 11:54:50 +01:00
Almero Steyn
b2b612ec5d [Docs] Add accessibility to tabs in installation documentation (#9431)
* Add accessibility to tabs in installation documentation

* Change color and fix styling

(cherry picked from commit 9526174e30)
2017-04-19 12:33:51 +01:00
Fabrizio Castellarin
6ef3fde642 Reorganize the "following along" instructions (#9453)
* Reorganize the "following along" instructions

* Minor tweaks

(cherry picked from commit 1ce562ead3)
2017-04-19 12:33:51 +01:00
Filip Hoško
8597fd4e12 FIX: Move CRA build info under it's tab page (#9452)
* FIX: Move CRA build info under it's tab page

* Add some links
2017-04-18 18:18:06 +01:00
Dan Abramov
85b3cdec82 Tweak tutorial structure 2017-04-18 18:07:27 +01:00
Dan Abramov
1001454683 Add missing tutorial sidebar links 2017-04-18 18:01:08 +01:00
Dan Abramov
e6df2eccfe Minor tutorial nits 2017-04-18 17:54:07 +01:00
Dan Abramov
3e44b5dc25 Fix duplicate sentence 2017-04-18 17:44:44 +01:00
Dan Abramov
f8ade2b30c Minor tweaks to tutorial 2017-04-18 17:41:17 +01:00
Frankie Bagnardi
53a0064533 [Tutorial] ES6, installation, and button closing tag (#9441)
* adds notes to tutorial on es6 and installation

* fixes tutorial mention of opening button tag

* More writing

* Update
2017-04-18 17:36:09 +01:00
Abhishek Soni
6afb4826f2 Fixed grammar (#9432)
* Update codebase-overview.md

* Some more fixes

(cherry picked from commit d724115144)
2017-04-18 16:51:05 +01:00
hanumanthan
3a8effb4fb Lift state up - Updating the documentation to mention that onClick is a synthetic event handler (#9427)
* Lift state up - Updating the documentation to mention that onClick is a synthetic event handler

* Review comments - Rephrase to handle synthetic events and event handler patterns

* Tweak

(cherry picked from commit 53a3939fb0)
2017-04-18 16:51:04 +01:00
Michał Ordon
8991f26887 Sort out conferences by date (#9172)
(cherry picked from commit 37f9e35ad9)
2017-04-18 16:51:04 +01:00
Jayen Ashar
7482e2a0e3 Update jsx-in-depth.md (#9178)
* Update jsx-in-depth.md

Line 9 isn't changed

* Move selection down

* Fix

(cherry picked from commit ccb38a96cf)
2017-04-18 16:51:04 +01:00
Fraser Haer
8f93e269d8 Unique headings for linking purposes (#9259)
Previously two headings were 'Javascript Expressions' - now 'Javascript
Expressions as Props' and 'Javascript Expressions as Children'
(cherry picked from commit 363f6cb2e5)
2017-04-18 16:51:04 +01:00
NE-SmallTown
2a44c5c726 [Documentation] Impreove the react-component section of doc (#9349)
* Impreove react-component of doc

[#9304](https://github.com/facebook/react/issues/9304)

* update description

* add missing space

(cherry picked from commit 359f5d276f)
2017-04-18 16:51:03 +01:00
Abhay Nikam
20a9c31f3d Updated the Good First Bug section in readme (#9429)
* Updated the Good First Bug section in readme

* Inconsistent use of quotes. Prefered single quotes instead of double quotes

* Updated Good first bug link in how_to_contribute doc.

* Undo JSX attribute quote change

* don't capitalize "beginner friendly issue"

(cherry picked from commit 36c935ca8f)
2017-04-18 16:51:03 +01:00
Dan Abramov
006ebb6421 Switch Installation to a tab when hash is present (#9422) 2017-04-13 21:51:42 +01:00
hanumanthan
7323d4cece Refractor docs to indicate that state set to props in constructor will not recieve the updated props (#9404) 2017-04-13 20:56:35 +01:00
Marks Polakovs
150c2e57f7 Add tabs to installation page (#9275, #9277) (#9401)
* Add tabs to installation page (#9275, #9277)

This adds tabs for create-react-app and existing apps to the installation section of the docs. The tab implementation is a simplified version of React Native's installation page.

Fixes #9275.

* Use classList instead of className

* Use same implementation as in RN
2017-04-13 20:56:18 +01:00
Jack
a63ecad10e Update proptypes doc (#9391)
* Update proptypes doc

* Removed note
2017-04-13 20:55:55 +01:00
Eric Elliott
d333bff906 Docs: Clarification of setState() behavior (#9329)
* Clarification of setState() behavior

`setState()` is a frequent source of confusion for people new to React, and I believe part of that is due to minimization of the impact of the asynchronous behavior of `setState()` in the documentation. This revision is an attempt to clarify that behavior. For motivation and justification, see [setState Gate](https://medium.com/javascript-scene/setstate-gate-abc10a9b2d82).

* Update reference-react-component.md

* Signature fix

* Update to address @acdlite concerns

* Add more details
2017-04-13 20:55:37 +01:00
Flarnie Marchan
6428cf7359 Quick fix for eslint on 15.6-dev branch
The `.eslintignore` had gotten a merge conflict committed accidentally
at some point, and also was not ignoring the `addons` directory. This
fixes that.

We also had a couple of missing commas that snuck in, and those are
fixed here too.
2017-04-13 11:42:48 -07:00
Brandon Dail
ddd8260e4b Update deprecation wording to be less aggressive 2017-04-13 11:42:48 -07:00
Brandon Dail
16c4f9006a Add test for deprecation warnings 2017-04-13 11:42:48 -07:00
Brandon Dail
8a011282a0 Deprecate React.createMixin
This API was never fully implemented. Since mixins are no longer considered part of the future React API, it will be removed.
2017-04-13 11:07:09 -07:00
Gabriel Lett Viviani
8e0150d09e Fix the proptypes deprecation warning url on the "Don't Call PropTypes Warning" doc page (#9419)
* Use the same prop-types link on the warning docs page as the main proptypes doc page

* Link to repo instead
2017-04-13 15:16:41 +01:00
Dominic Gannaway
e78b192e14 Update typechecking-with-proptypes.md (#9392)
* Update typechecking-with-proptypes.md

* Update typechecking-with-proptypes.md

* Use consistent style for PropTypes import
2017-04-12 00:05:11 +01:00
Denis Pismenny
fd6eece6af Fix minor typo in lifting-state-up.md (#9408) 2017-04-11 22:06:30 +01:00
Maciej Kasprzyk
9e9e0c700c Delete examples dir from codebase overview (#9397)
Removes doc about folder that no longer exists.
2017-04-11 22:05:47 +01:00
Luke Belliveau
8f951556e1 Amended implementation-notes.md with link to Dan Abramov's post describing difference between React components, elements, and instances (#9388)
* Amended implementation-notes.md to include a link to a blog post by Dan Abramov, explaining the difference between components, elements, and instances. An understanding of this distinction is crucial in tracing through Implementation pseudocode, and reading Dan's blog first may ease newcomers into understanding the implementation.

* adjusted wording to maintain stylistic consistency with rest of content, per @aweary's request
2017-04-11 22:05:23 +01:00
Dan Abramov
7256081ae3 Use caret range in blog instructions
The release was a bit broken.
2017-04-11 22:05:03 +01:00
Dan Abramov
cef396d092 15.5.4 2017-04-11 20:23:39 +01:00
Dan Abramov
e0da5edd58 Merge branch '15.5-dev' into 15-stable 2017-04-11 20:12:14 +01:00
Dan Abramov
88b5c1401b Delete prop-types folder as it has moved 2017-04-11 20:12:05 +01:00
Dan Abramov
fec0004a31 Merge branch '15.5-dev' into 15-stable 2017-04-11 20:11:38 +01:00
Dan Abramov
545c87fdc3 Update prop-types version 2017-04-11 20:10:53 +01:00
Dan Abramov
53a3b46fa9 Update prop-types version 2017-04-11 20:08:49 +01:00
Andrew Clark
88bb4a2b50 create-react-class version 15.5.2 2017-04-10 09:51:38 -07:00
Andrew Clark
0b716b8896 Merge branch '15-stable' of https://github.com/facebook/react into 15-stable 2017-04-10 09:47:18 -07:00
Brian Vaughn
26b0530302 Bumped react-linked-input version from 15.5.0 to 15.5.1 2017-04-08 21:56:18 -07:00
Dan Abramov
63d98abeb3 Bump addons I have permissions for 2017-04-09 04:26:41 +01:00
Dan Abramov
80b862395d Fixes for 15.5 addons (#9385)
* Add missing object-assign dep to create-react-class

* Remove unnecessary inlines and irrelevant tests in createFragment

* Uninline shallowEqual in shallowCompare

* Uninline invariant in update

* Uninline invariant/warning and remove unreachable code in react-linked-input

* Envify and collapse createClass UMD

* Envify and collapse createFragment

* ReactLink doesn't really need PropTypes dep

It is unnecessary because it is not explicitly exposed and was never public API.

* Rebuild, envify and collapse LinkedStateMixin UMD

* Collapse PureRenderMixin UMD

* Rebuild shallowCompare

* Envify and collapse update UMD

* Remove unused prop-types dep from linked-input

* Fix change handling in LinkedInput

* Compile LinkedInput to ES5

* Rebuild, collapse, and fix LinkedInput UMD

* Add full README for react-addons-create-fragment

* Mention compat version of transition-group so we can delete those docs

* README for react-addons-linked-state-mixin

* More docs

* Fix devDeps for createClass

* docs
2017-04-09 04:01:35 +01:00
Dan Abramov
9609cb7402 Merge branch '15.5-dev' into 15-stable 2017-04-08 23:15:35 +01:00
Derrick Yeung
c2ca2f57f6 Fix the react-addons-create-fragment package to properly export the createReactFragment() function (#9383) 2017-04-08 23:03:18 +01:00
Dan Abramov
69933e25c3 Expose batchedUpdates on shallow renderer (#9382) 2017-04-08 22:46:04 +01:00
Brian Vaughn
b563af4b4c Merge branch '15-stable' of github.com:facebook/react into 15-stable 2017-04-08 11:13:15 -07:00
Andrew Clark
0a7c4b3858 15.5.3 2017-04-07 21:08:39 -07:00
Andrew Clark
32c04c038f 15.5.2 2017-04-07 21:08:22 -07:00
Andrew Clark
6456fa71d9 Add README to create-react-class 2017-04-07 21:08:21 -07:00
Andrew Clark
e2db791e75 15.5.1 2017-04-07 21:08:21 -07:00
Dan Abramov
6c74952077 Build shallow renderer independently (#9375) 2017-04-07 21:06:47 -07:00
Brian Vaughn
7c0e407e44 Merge branch '15-stable' of github.com:facebook/react into 15-stable 2017-04-07 20:28:42 -07:00
Dan Abramov
7dbf2b348c Bump React version on doc website 2017-04-08 04:11:04 +01:00
Aaron Ackerman
129956a65d Point users to the npm page instead of the github project for prop-types (#9373) 2017-04-08 04:07:19 +01:00
Andrew Clark
85d1816d03 Bump prop-types version 2017-04-07 15:29:38 -07:00
Andrew Clark
e1919638b3 const -> var 2017-04-07 15:28:21 -07:00
Brian Vaughn
c5c5524d20 Updated addons package versions 2017-04-07 14:50:01 -07:00
Andrew Clark
245ea0c358 Blog post and changelog for 15.5.0 (#9368) 2017-04-07 14:46:29 -07:00
Andrew Clark
c54ad571e5 Update React version in docs 2017-04-07 14:35:00 -07:00
Andrew Clark
ec97ebbe7f Fix erroneous PropTypes access warning 2017-04-07 14:26:37 -07:00
Andrew Clark
e19c70013e 15.5.0 2017-04-07 14:21:27 -07:00
Andrew Clark
be8f6fd62b Update yarn lockfile 2017-04-07 14:20:17 -07:00
Andrew Clark
cf205f35f4 Merge branch '15.5-dev' into 15-stable 2017-04-07 14:18:32 -07:00
Flarnie Marchan
4a3b790ce4 Update example snippet in old 'React.addons' doc page (#9363)
* Update example snippet in old 'React.addons' doc page

This makes the example more consistent.

* Add back the pointers in docs that were mistakenly removed

In https://github.com/facebook/react/pull/9359 we accidentally removed
pointers in some doc pages. Putting them back now.

* Link to npm package instead of github page

This seems like a more stable place to link to in the 'context'
document.
Based on @bvaughn's feedback in https://github.com/facebook/react/pull/9359
2017-04-07 14:13:53 -07:00
Flarnie Marchan
0420e96a41 All doc updates forv15.5 (#9359)
* `react-addons-test-utils` -> `react-dom/test-utils`

Updating all references and docs on the `React.addons.TestUtils` and the
shallow renderer to refer to the correct targets.

Instead of:
```
const React = require('react');

// ...
React.addons.Testutils
// or

const ReactTestUtils = require('react-addons-test-utils');
```
we now show:
```
const ReactTestUtils = require('react-dom/test-utils');
```

And for shallow renderer, instead of:
```
const shallowRenderer = TestUtils.createRenderer();
```

we now show:
```
const shallowRenderer = require('react-test-renderer/shallow');
```

* Update the 'prev' and 'next' attributes of 'add-ons' docs

These flags are used to set arrow links to easily navigate through the
documents. They were wrong or missing in some of the 'add-ons' pages and
this bothered me when manually testing the updates from the previous
commit.

* Update syntax for instantiating shallow renderer

Missed this when updating the docs for the changes to shallow-renderer
in React 15.5.

* Fix pointers in addons docs

Thanks @bvaughn for catching this

* Make example of shallow renderer more consistent

We should show using the same variable names between code samples.

* Make names in example even more consistent

We should use the same variable name for the same thing across examples.
`renderer` -> `shallowRenderer`.

* Update docs to deprecate React<CSS>TransitionGroup

 - removes link to the docs about `ReactCSSTransitionGroup` and
   `ReactTransitionGroup` from the main navigation
 - updates 'prev' and 'next' pointers to skip this page
 - adds deprecation warning to the top of the page
 - remove references to these modules from the packages README
 - updates 'add-ons' main page to list this as a deprecated add-on

* Update `React.createClass` to `createReactClass` in the docs

The `React.createClass` method is being deprecated in favor of
`createReactClass`.

* Remove 'React.createClass' from top level API docs

It no longer makes sense to have a section for the 'createClass' method
in this page, since it won't be available as a top level method on
'React'.

I initially was going to pull the section about 'createClass' into a
separate page to add under 'addons' but it was short and duplicative of
the 'react-without-es6' docs. So I just linked to those.

* Remove *most* `React.PropTypes` from the docs

I am doing the docs for `context` in a separate commit because that case
was a bit less clear-cut.

We will no longer support `React.PropTypes` as a built-in feature of
React, and instead should direct folks to use the `PropTypes` project
that stands alone.

Rather than retaining the `React.PropTypes` examples and just revamping
them to show the use of the stand-alone `PropTypes` library with React,
it makes more sense to direct people to that project and reduce the
perceived API area and complexity of React core. The proper place to
document `PropTypes` is in the README or docs of that project, not in
React docs.

* Update `context` docs to not use `React.PropTypes`

We use `React.PropTypes` to define the `contextType` for the `context`
feature of React. It's unclear how this will work once `React.PropTypes`
is replaced by the external `PropTypes` library. Some options;

a) Deprecate `context`, either in v16 or shortly after. Seems reasonable
based on the intense warnings against using context that we have in the
docs -
https://facebook.github.io/react/docs/context.html#why-not-to-use-context
**Except** that probably some widely used libraries depend on it, like
`React-Router`.

b) Expect users will use external `PropTypes` library when defining
`contextTypes` and just don't do our `checkReactTypeSpec` against them
any more in v16.

c) Stop masking context and pass the whole context
unmasked everywhere. Worst option, do not recommend.

I went with `b` and assume that, for now, we will get users to use the
external `PropTypes` when defining context. I will update this PR if we
want a different approach.

* Remove 'addons' items from left nav, and deprecate 'addons' doc page

The plan:
[X] Remove links to 'addons' items from main navigation
[X] Add deprecation notices where appropriate, and update syntax to show
using the separate modules.
[ ] Update other references to 'React.addons' in docs. Coming in next
commit.
--- blocked but coming in future PRs
[ ] Link to a blog post describing the new locations of add-ons in the
deprecation notice on the '/docs/addons.html' page. Blocked until we
actually publish that blog post.
[ ] Move the docs for each add-on to the actual github repo where it now
lives.
[ ] Redirect the old add-ons doc permalinks to the docs in the separate
github repos for those modules.
[ ] Remove the old add-ons doc markdown files from React core docs.

* Remove references to `React.addons` from docs

Just misc. places where we referenced the 'addons' feature. All gone!
2017-04-07 14:12:10 -07:00
Damian Nicholson
364d4a4ea1 Added semicolons to addons imports examples. (#9287) 2017-04-07 14:10:01 -07:00
najisawas
7a11c572e6 Fixed typo on implementation notes page (#9258)
Added paren to "mountComponent()" for consistency
2017-04-07 14:06:58 -07:00
Giorgio Polvara
9b4d42ca64 Fix typo (#7953) 2017-04-07 14:06:36 -07:00
Dan Abramov
b3ec0cb488 Remove examples/ folder (#9323) 2017-04-07 14:05:17 -07:00
Aaron Cannon
b596e0bcaa Make it clear that textarea also supports defaultValue. (#9318) 2017-04-07 14:04:03 -07:00
Justin
b9f9b3cce6 Fix grammar typo in Design Principles docs (#9324)
features → feature
> There is nothing "bad" about using state or lifecycle hooks in components. Like any powerful feature**s**, they should be used in moderation, but we have no intention to remove them.

I can’t explain the exact grammatical principle this violates, but it sounds wrong to my native English ears that “feature” is plural here. Another way to check if the grammar sounds right is to change the order of the clauses: ”They should be used in moderation, like any powerful feature“ sounds right, whereas “They should be used in moderation, like any powerful features” does not.
2017-04-07 14:03:46 -07:00
Dan Abramov
c549c8b66e Update build paths in docs (#9340) 2017-04-07 14:03:09 -07:00
Andrew Clark
15b507c5c4 Add .createRenderer method to ReactShallowRenderer 2017-04-07 13:46:20 -07:00
Andrew Clark
4ee1651e54 Update changelog 2017-04-07 01:21:25 -07:00
Andrew Clark
9ba974aff4 Update changelog for 15.5.0 2017-04-06 17:14:44 -07:00
Brian Vaughn
d1bae78189 Updated packages for 15.5.0-rc.2 2017-04-06 16:09:55 -07:00
Andrew Clark
ce74e00e5a Fix ReactWithAddons umd build 2017-04-06 16:03:49 -07:00
Brian Vaughn
28a179021e Merge branch '15.5-dev' of github.com:facebook/react into 15.5-dev 2017-04-06 14:55:21 -07:00
Brian Vaughn
1d22ff7fa1 Replaced ReactTestReconcileTransaction with ReactReconcileTransaction in shallowRenderer 2017-04-06 14:55:11 -07:00
Andrew Clark
22bde0e5ba Update yarn.lock in addons 2017-04-06 14:31:51 -07:00
Andrew Clark
49868d8615 Fix references to React.createClass and React.PropTypes 2017-04-06 14:21:49 -07:00
Brian Vaughn
486bbf0fe8 Added prop-types dep for react-linked-input and re-built 2017-04-06 13:47:34 -07:00
Andrew Clark
12a96b9482 Fix references to React.createClass and React.PropTypes 2017-04-06 13:17:34 -07:00
Brian Vaughn
d11c5467bd Replaced another console.error() call with fbjs warning() 2017-04-06 11:39:31 -07:00
Brian Vaughn
4f5aa2e40d Replaced console.error() in test utils with warning() 2017-04-06 11:36:58 -07:00
Brian Vaughn
714e5ea65e Moved shallow renderer injections into render() method to avoid conflict with react-dom 2017-04-06 11:29:41 -07:00
Andrew Clark
72531d330d TransitionGroup should use prop-types package 2017-04-06 11:07:46 -07:00
Brian Vaughn
67e3e0e856 Added missing files:test-utils.js entry to react-dom package.json 2017-04-06 10:56:57 -07:00
Andrew Clark
1f487eb933 15.5.0-rc.1 2017-04-05 11:39:12 -07:00
Andrew Clark
94313e9a09 Update yarn lockfile 2017-04-05 11:28:19 -07:00
Andrew Clark
40b37c64c8 Uncommenting this warning even though tests haven't been updated yet
I'll fix the tests later.
2017-04-05 11:21:08 -07:00
Brian Vaughn
f686b8195b Updated react-addons-test-utils package.json for RC 2017-04-04 14:38:30 -07:00
Andrew Clark
043845ce75 Extract ReactPropTypes to separate module 2017-04-04 14:29:11 -07:00
Brian Vaughn
3a7eef2bcf Test utils deprecations and updates:
1. Moved react-addons-test-utils to react-dom/test-utils and added deprecation message.
2. Moved shallow renderer (previous accessible via TestUtils.createRenderer) to react-test-renderer/shallow and added deprecation message.
3. Updated READMEs for react-addons-test-utils and react-test-renderer
2017-04-04 13:47:05 -07:00
Brian Vaughn
550381b57a Converted react-addons-create-fragment to ES5 and bumped to 15.5.1 2017-04-02 11:21:34 -07:00
Brian Vaughn
ca2e8861e5 Replaced react-create-class references with create-react-class 2017-03-31 14:59:50 -07:00
Brian Vaughn
f42f38e1ba Renamed react-create-class to create-react-class and fixed up tests to run in addons folder 2017-03-31 14:50:24 -07:00
Brian Vaughn
e264323124 Changed dev-deps to 15.4.2 by default rather than 16.0.0 2017-03-31 14:22:13 -07:00
Brian Vaughn
8ae798a089 Added dev deps for testing 2017-03-31 14:22:01 -07:00
Brian Vaughn
90def2bf22 Added missing dev-deps for react-addons-update and prepped for release 15.5.0 2017-03-31 14:07:15 -07:00
Brian Vaughn
86979e36d5 Updated package.json version 2017-03-31 13:44:21 -07:00
Brian Vaughn
168d13713a Added yarn.lock file; updated package.json for 15.5.0 2017-03-31 13:34:53 -07:00
Brian Vaughn
34eab5d7fe Prepped for 15.5 release; added Yarn lockfile. Added missing devDep to package.json 2017-03-31 13:30:24 -07:00
Brian Vaughn
14ee35a791 Prep for 15.5.0 2017-03-31 12:45:59 -07:00
Brian Vaughn
5c8d40b5f1 Prepping for 15.5.0 release of react-addons-css-transition-group 2017-03-31 10:58:44 -07:00
Brian Vaughn
4e19d810df Updated package.json for react-addons-create-fragment 2017-03-31 10:53:04 -07:00
Brian Vaughn
f803f77561 Added devDeps for react-addons-create-fragment to make testing easier 2017-03-31 10:46:46 -07:00
Brian Vaughn
2804fa9dfe Make sure all package.json have valid "files" array, including UMD build 2017-03-31 10:40:57 -07:00
Brian Vaughn
67a8db3650 Removed 'peerDependencies' block from package.json for add-ons we think will continue to work for the forseeable future 2017-03-30 08:37:42 -07:00
Nathan Hunzaker
fe4a5b4004 Fix Chrome number input backspace and invalid input issue (#7359)
* Only re-assign defaultValue if it is different

* Do not set value if it is the same

* Properly cover defaultValue

* Use coercion to be smart about value assignment

* Add explanation of loose type checks in value assignment.

* Add test coverage for setAttribute update.

* Only apply loose value check to text inputs

* Fix case where empty switches to zero

* Handle zero case in controlled input

* Correct mistake with default value assignment after rebase

* Do not assign bad input to number input

* Only trigger number input value attribute updates on blur

* Remove reference to LinkedValueUtils

* Record new fiber tests

* Add tests for blurred number input behavior

* Replace onBlur wrapper with rule in ChangeEventPlugin

* Sift down to only number inputs

* Re-record fiber tests

* Add test case for updating attribute on uncontrolled inputs. Make related correction

* Handle uncontrolled inputs, integrate fiber

* Reorder boolean to mitigate DOM checks

* Only assign value if it is different

* Add number input browser test fixtures

During the course of the number input fix, we uncovered many edge
cases. This commit adds browser test fixtures for each of those instances.

* Address edge case preventing number precision lower than 1 place

0.0 coerces to 0, however they are not the same value when doing
string comparision. This prevented controlled number inputs from
inputing the characters `0.00`.

Also adds test cases.

* Accommodate lack of IE9 number input support

IE9 does not support number inputs. Number inputs in IE9 fallback to
traditional text inputs. This means that accessing `input.value` will
report the raw text, rather than parsing a numeric value.

This commit makes the ReactDOMInput wrapper check to see if the `type`
prop has been configured to `"number"`. In those cases, it will
perform a comparison based upon `parseFloat` instead of the raw input
value.

* Remove footnotes about IE exponent issues

With the recent IE9 fix, IE properly inserts `e` when it produces an
invalid number.

* Address exception in IE9/10 ChangeEventPlugin blur event

On blur, inputs have their values assigned. This is so that number
inputs do not conduct unexpected behavior in
Chrome/Safari. Unfortunately, there are cases where the target
instance might be undefined in IE9/10, raising an exception.

* Migrate over ReactDOMInput.js number input fixes to Fiber

Also re-record tests

* Update number fixtures to use latest components

* Add number input test case for dashes and negative numbers

* Replace trailing dash test case with replace with dash

Also run prettier
2017-03-28 11:35:23 -07:00
Jirat Ki
ef38390666 Add component stack to invalid element type warning (#8495)
* Show Source Error Addemden if __source available

* Add Parent Stack on invalid element type

* refactor to use normalizeCodeLocInfo

* Remove ( ) from addendum
2017-03-28 11:16:04 -07:00
Gaëtan Renaudeau
17434d7263 Fix test renderer unmount (#8512)
* [react-test-renderer] unmount the inner instances

Fixes https://github.com/facebook/react/issues/8459

* add a test for https://github.com/facebook/react/issues/8459

* add new test in tests-passing.txt
2017-03-28 11:05:25 -07:00
Maksim Shastsel
ac53db35e7 Delete @nosideeffect annotation (#8882) 2017-03-28 11:02:38 -07:00
António Nuno Monteiro
9d21b524ff Change the order between function declaration and object assignment (#8895)
This fixes #8894
2017-03-28 11:02:11 -07:00
Jon Bretman
e33eab40a6 Bump fbjs to 0.8.9 (#8910) 2017-03-28 11:00:38 -07:00
Brian Vaughn
a27e5d374a Merge branch '15.5-dev' of github.com:facebook/react into 15.5-dev 2017-03-27 22:58:12 -07:00
Brian Vaughn
096fe67010 Added react-addons-css-transition-group and react-addons-transition-group 2017-03-27 22:57:36 -07:00
Brian Vaughn
fe451dd59d Renamed LICENSE.txt => LICENSE 2017-03-27 22:57:22 -07:00
Andrew Clark
be63a4fa01 Merge branch '15.5-dev' of https://github.com/facebook/react into 15.5-dev 2017-03-27 16:23:49 -07:00
Andrew Clark
322076a8c2 Future-proof react-create-class
- Backport change to enqueueReplaceState. Use new API instead of
enqueueCallback, which is gone in 16.
- Implement isMounted using lifecycles, so we have the option of
removing this later.
2017-03-27 16:23:45 -07:00
Brian Vaughn
d56011ad61 Added react-linked-input package 2017-03-27 14:23:22 -07:00
Brian Vaughn
b922d0b808 Added react-addons-update addon 2017-03-27 13:26:47 -07:00
Brian Vaughn
76bf3137e0 Added react-addons-linked-state-mixin with UMD builds and tests 2017-03-27 13:04:10 -07:00
Brian Vaughn
21366a9fe4 Bumped addon versions to alpha0 2017-03-24 15:28:34 -07:00
Andrew Clark
52f880f405 react-addons-pure-render-mixin@15.5.0-alpha.0 2017-03-24 15:17:40 -07:00
Andrew Clark
e535d58feb Fix imports in CJS entry 2017-03-24 15:16:49 -07:00
Brian Vaughn
83dc547327 Merge branch '15.5-dev' of github.com:facebook/react into 15.5-dev 2017-03-24 14:18:18 -07:00
Brian Vaughn
5117dc2766 Updated shallowCompare add-on package to not reference internals 2017-03-24 14:17:52 -07:00
Johan Tinglöf
e700f42138 Updated Router import for example (#9233)
Updated import in order to be a correct working example as in accordance with the docs
(cherry picked from commit 38d8f3ee6b)
2017-03-24 09:49:26 -05:00
Bernard Lin
5232246116 Conferences (#9234)
* standard format for React Rally

* move React Conf 2017 to past conferences

(cherry picked from commit fbc6977fbc)
2017-03-24 09:49:26 -05:00
CodinCat
7835fdcd21 Use single quotes, remove extra whitespace (#9215)
(cherry picked from commit 0ceb5115ac)
2017-03-24 09:49:25 -05:00
Jamison Dance
76373012fb Add React Rally to conferences list (#9179)
(cherry picked from commit 7253e6544b)
2017-03-24 09:49:25 -05:00
Bernard Lin
1061125572 Updated React Native EU (#9170)
* Updated Chain React

Changed conference date from "Summer 2017" to given date on website

* Updated React Native EU

Updated date and place with information from website

(cherry picked from commit 2b59afb984)
2017-03-24 09:49:25 -05:00
Andrew Clark
c5395d23e5 Merge pull request #9187 from acdlite/prettierci
Failing to run prettier should block CI
(cherry picked from commit 9549ebfae5)
2017-03-24 09:48:44 -05:00
Andrew Clark
d9a4fa4f51 Replace createClass with external react-create-class dependency
Warns when using React.createClass for the first time.

Usages of createClass in tests have been converted to plain JavaScript
classes. Tests that rely on replaceState or isMounted use
updater.enqueueReplaceState and updater.isMounted.
2017-03-21 14:57:50 -07:00
Andrew Clark
60a795575f Create react-create-class package
Extract createClass into a separate package so we can deprecate it in
version 16.
2017-03-21 14:28:09 -07:00
Andrew Clark
8a06cd7a78 Fix version number and remove peerDependencies 2017-03-17 17:28:01 -07:00
Brian Vaughn
c6118eb209 Added react-addons-create-fragment package 2017-03-17 16:51:36 -07:00
William Cunningham
50afe2ef5a Move getNextDebugID() to React package.
The module, and its internal state, was duplicated in several packages,
leading to duplicate ids when multiple renderers were used.
2017-03-17 15:35:20 -07:00
Adam
91b1cde5d6 Remove ref usage in main markdown example (#9160)
from [elsewhere in the docs](https://facebook.github.io/react/docs/refs-and-the-dom.html):

> Avoid using refs for anything that can be done declaratively.
(cherry picked from commit bf5abdf14f)
2017-03-12 15:45:59 +00:00
Dan Abramov
baddb6bf42 Remove PR check from GH Pages build hook for stable branch (#9144) 2017-03-10 01:19:33 +00:00
Dan Abramov
39ff5c4895 Reorder sections in alphabetical order (#9143)
* Reorder sections in alphabetical order

* Reorder here too

(cherry picked from commit 7fa311bcd9)
2017-03-09 20:47:20 +00:00
Dima Beznos
c1ba5b2ddc Added Brunch build tool to the docs (#9074)
* Added Brunch build tool to the docs

* Improved grammar

* product build -> production build

(cherry picked from commit 0bedd0697a)
2017-03-09 20:44:06 +00:00
Sunny Ripert
b2aa4d143f Fix spacing in documentation (#9070)
Replace non-breaking space by space.
(cherry picked from commit 179240ca30)
2017-03-09 20:44:06 +00:00
Vesa Laakso
0777ef9c2f Update Lifting State Up not to mix up DOM value with component state (#9032)
* Update Lifting State Up not to mix up DOM value with component state

A few weeks ago when teaching my friend, she got stuck on
`this.state.value` vs. `event.target.value`. As the documentation
talked a lot about "values", and the term value could mean three
different things (values in general, the "value" prop / DOM value of
the <input> component and the value in state/props), it was not weird
that she got a bit confused.

* Rename Lifting State Up onChange props to onTemperatureChange

This is in-line with how the temperature is provided as a prop named `temperature`

* Fix one value prop not being renamed to temperature

* Update codepen examples in Lifting state up documentation

* Update devtools state change to reflect docs change

(cherry picked from commit a190cfce29)
2017-03-09 20:44:06 +00:00
Bryan Braun
64ab3a383e Replace the header_links plugin with client-side generated anchors. (#4165)
* Replace the header_links plugin with client-side generated anchors.

Fixes facebook/react#4124

* Move anchor-link code into a separate script

Also adds a couple comments, for context.

(cherry picked from commit 7a878d27e3)
2017-03-09 20:44:06 +00:00
Fokke Zandbergen
c7d14df920 Square renders button, not div (#9084)
(cherry picked from commit 8eb7068364)
2017-03-09 20:44:06 +00:00
Bernard Lin
1edc84a38c Updated Chain React (#9067)
Changed conference date from "Summer 2017" to given date on website
(cherry picked from commit fe46def5e2)
2017-03-09 20:44:05 +00:00
Dai Nguyen
c04ced9c7e Update tutorial.md (#9051)
(cherry picked from commit d724aed404)
2017-03-09 20:44:05 +00:00
Stephie
d6842d3140 Fixed typo: "Calcutor" to "Calculator" (#9047)
(cherry picked from commit 5cc2a4fe3e)
2017-03-09 20:44:05 +00:00
Dan Abramov
c53314a3da Add more details to the doc 2017-02-19 12:08:18 +00:00
Dan Abramov
8cfc95f2d3 Doc consistency tweaks 2017-02-19 11:59:01 +00:00
Roman Matusevich
67420d1d08 Remove extra article from documentation (#9028)
(cherry picked from commit d28264e689)
2017-02-19 11:12:08 +00:00
DanZeuss
6256f3e8b0 Improved for a better understanding (#8970)
* Improved for a better understanding

that code shouldn't name this parameter onchange. It is so confusing for a starter of ReactJs like me. It looks like that the onChange is an common event from props.

* Update the lifting state up paragraph

I tried to write something to explain to starter programmers in react, how we lift the state up calling a method defined by the ancestor and called by the children that will affect the children element.

* Rewrite Lifting State Up

(cherry picked from commit fc362bf095)
2017-02-19 11:12:08 +00:00
Dan Abramov
1d786cd992 Revert "update react perf docs (#8060) and (#6174)" (#8997) 2017-02-13 23:45:32 +00:00
Dan Abramov
1d4b165476 Update Thinking in React embed to match the link (#8996)
(cherry picked from commit 2464cd2d53)
2017-02-13 23:30:52 +00:00
Jiminikiz
b3fd863141 Fixing grammatical error ... (#8987)
... in the Create React App section.
(cherry picked from commit 7958c1d77d)
2017-02-13 23:30:52 +00:00
Prayag Verma
34b6e1f80c Fix a typo in design principles doc (#8985)
unambigious → unambiguous
(cherry picked from commit c60f852cdb)
2017-02-13 23:30:52 +00:00
Moacir Rosa
9e5ad597cb Only fix a small wrong key in example (#8976)
Only fix a small wrong key in example
(cherry picked from commit de673bca8d)
2017-02-13 23:30:52 +00:00
Dhyey Thakore
b53a582daa update react perf docs (#8060) and (#6174) (#8236)
* update react perf docs issue 8060 and 6174

* Grammar

Small stuff

(cherry picked from commit 994a0c8b0c)
2017-02-13 23:30:52 +00:00
Andrew Clark
2a644ae7ae Merge pull request #8927 from mitenka/patch-5
Update higher-order-components.md
(cherry picked from commit b49611e643)
2017-02-13 23:30:51 +00:00
KB
aff32728ca [docs] Add note about refs on stateless components (#8916)
* Add note about refs on stateless components

* Move info about refs in the stateless components to the main section

* Simplification of the part about refs and functional components

* Tweaks

* Move sections around

* Oops

* Rearrange more sections

(cherry picked from commit d42c285aa2)
2017-02-06 17:11:27 +00:00
Pontus Abrahamsson
ecc6e79407 Update conferences.md (#8915)
* Update conferences.md

* Move confs around

(cherry picked from commit 55a18bca64)
2017-02-06 17:11:27 +00:00
Omid Hezaveh
49762d28e4 Explain arbitrariness of ref name in callback (#8913)
* Explain arbitrariness of ref name in callback

The sample code was confusing because it's not clear that "textInput" in this.textInput is an arbitrary name for the ref.

* Tweak wording

(cherry picked from commit 79be3543dd)
2017-02-06 17:11:27 +00:00
Dan Abramov
4a2fad0d04 Fix indentation in tutorial (#8914)
(cherry picked from commit 9e3a31b2c6)
2017-02-02 13:25:22 +00:00
Eduard
2d130bfba2 Update tutorial.md (#8896)
* Update tutorial.md

The status <div> used in Board can be deleted as well from render.

* Little tweaks

(cherry picked from commit dc04ee87ae)
2017-02-02 13:25:22 +00:00
Tiago Fernandez
d5eb5a23c6 Link to CodePen editor rather than final result (#8849)
People want to see the final JS/CSS/HTML, and the final result is already displayed by CodePen.
(cherry picked from commit 05f5bf6eb6)
2017-02-02 13:25:22 +00:00
Jeffrey Wan
73a6762fe2 Update tutorial.md (#8792)
* Update tutorial.md

* Fix quoting to be consistent

(cherry picked from commit 3f5482ee20)
2017-02-02 13:25:22 +00:00
John Longanecker
952b7dec91 Lifting State Up more legible (#8691)
(cherry picked from commit b8f0522cc6)
2017-02-02 13:25:22 +00:00
Vladimir Kovpak
74b8ab5db1 Added undefined example (#8899)
Into section `Booleans, Null, and Undefined Are Ignored` I've added example with undefined.
(cherry picked from commit 8bc5a87d04)
2017-02-02 13:25:21 +00:00
Senin Roman
33ebd79ac3 Fix incorrect markup for ie10 (#8886)
(cherry picked from commit 466bb4ffb9)
2017-02-02 13:25:21 +00:00
MICHAEL JACKSON
1507765a2c Update context example for react-router v4 beta (#8889)
* Update context example for react-router@4.0.0-beta.1

* Style nits

(cherry picked from commit 564fa64626)
2017-02-02 13:25:21 +00:00
Mitchel Humpherys
07edc56551 installation.md: Add missing "as" (#8871)
(cherry picked from commit 39472f1c3e)
2017-02-02 13:25:21 +00:00
Scott
589b2ce815 Add benchmarking tutorial (#8698)
* Add benchmarking tutorial

I've written what I hope is the simplest introduction to benchmarking React components. It's meant to be straightforward and easy to follow for beginners. If you agree that it would be helpful, I'd like to add it to the docs.
Would also welcome any and all feedback.

* Just put links together

(cherry picked from commit 4c6fec902f)
2017-02-02 13:25:20 +00:00
Oscar Bolmsten
5e06732b2f webpack 2 is now stable (#8859)
Remove notice about different webpack versions
Update webpack URLs
(cherry picked from commit c2f94385a1)
2017-02-02 13:25:20 +00:00
Keyan Zhang
80b8d5adac Add a link to "State Updates are Merged" in the forms doc (#8851)
* Added a link to "State Updates are Merged"

* better inline links

* moved the explanation down

* Minor unrelated tweaks

(cherry picked from commit eb89bc4c30)
2017-01-23 20:10:55 +00:00
mguidotto
4f32c39eb8 Update conferences.md (#8841)
* Update conferences.md

* Update conferences.md

path fixed

* Changed capitalization to match the website and Twitter

(cherry picked from commit b2b6d9daf7)
2017-01-23 20:10:55 +00:00
Dan Abramov
e6d377d21d Clarify use of ES6 idiom in Forms doc 2017-01-23 17:59:55 +00:00
Dan Abramov
74a4730073 Merge branch '15-dev' into 15-stable
Replaces npm shrinkwrap with Yarn lockfile
2017-01-23 17:52:37 +00:00
Dan Abramov
ccd68cb4ed Update deps and replace shrinkwrap with lockfile
This brings us closer to what we have on master.
2017-01-23 17:49:55 +00:00
Jack Cross
0b6f33033b Add CircleCI support to 15-stable (#8778)
* devDependencies: add core-js and es6-symbol polyfill for tests

* Update Flow and fix issues (#8006)

* Add npm v4.0.0 support (#8082)

* Add support for node v7 (#8135)

* Upgrade ESLint and dependencies, fix new lint errors, switch Travis to Yarn (#8309)

* Update ESLint to 3.10.2

Also pull in fbjs for extending properly, per @zpao. This also disables consistent-return, which has about 80 failing cases in React currently. If we'd like to turn this back on, we should do it separately and fix all the call sites properly (rather than just adding 'return undefined;' everywhere, which adds no value.

Fixes to all existing lint errors plus an update for yarn.lock to follow.

* Update yarn.lock after the eslint update.

* Fix all new eslint failures

Unfortunately I had to add three eslint-disable-next-line instances. All have explanations inline.

* Switch Travis to use yarn instead of npm

* Update all Jest packages to 17.x (#8327)

* Update all Jest packages to 17.x, cache babel-jest transforms

* Remove the caching

Looking at the other builds it doesn't seem to actually be that necessary.  The bottleneck is executors, not build time.

* Remove unnecessary package, fix fiber test runner

* Regenerate yarn lockfile

* Update Flow to 0.37.0 (#8608)

Nothing really changes.

* Update to Jest 18 (#8621)

* mockImpl -> mockImplementation

D4329549

* Fixed linting errors

* circle.yml and circleci scripts

* Update Flow and fix issues (#8006)

* Fixed flow errors

* Updated shrinkwrap

* Removed unnecessary change

* Added jest --runInBand flag

* Removed ReactDOMFiber changes
2017-01-23 17:46:31 +00:00
Jack Cross
688490dfe9 Add CircleCI support to 15-stable (#8778)
* devDependencies: add core-js and es6-symbol polyfill for tests

* Update Flow and fix issues (#8006)

* Add npm v4.0.0 support (#8082)

* Add support for node v7 (#8135)

* Upgrade ESLint and dependencies, fix new lint errors, switch Travis to Yarn (#8309)

* Update ESLint to 3.10.2

Also pull in fbjs for extending properly, per @zpao. This also disables consistent-return, which has about 80 failing cases in React currently. If we'd like to turn this back on, we should do it separately and fix all the call sites properly (rather than just adding 'return undefined;' everywhere, which adds no value.

Fixes to all existing lint errors plus an update for yarn.lock to follow.

* Update yarn.lock after the eslint update.

* Fix all new eslint failures

Unfortunately I had to add three eslint-disable-next-line instances. All have explanations inline.

* Switch Travis to use yarn instead of npm

* Update all Jest packages to 17.x (#8327)

* Update all Jest packages to 17.x, cache babel-jest transforms

* Remove the caching

Looking at the other builds it doesn't seem to actually be that necessary.  The bottleneck is executors, not build time.

* Remove unnecessary package, fix fiber test runner

* Regenerate yarn lockfile

* Update Flow to 0.37.0 (#8608)

Nothing really changes.

* Update to Jest 18 (#8621)

* mockImpl -> mockImplementation

D4329549

* Fixed linting errors

* circle.yml and circleci scripts

* Update Flow and fix issues (#8006)

* Fixed flow errors

* Updated shrinkwrap

* Removed unnecessary change

* Added jest --runInBand flag

* Removed ReactDOMFiber changes
2017-01-23 18:20:50 +01:00
Justin Grant
ef96e593a3 Reminder: strip quotes from attributes with JS code (#8806)
* Reminder: strip quotes from attributes with JS code

Web developers who are used to standards-compliant HTML and XML will, out of habit, put quotes around all attributes because the standards require them. Other templating systems like ASP.NET also require (or at least allow) quotes around attributes that contain code. This behavior will get users into trouble in JSX because a quoted attribute is always treated as a string literal, even if it contains curly-braced javascript code.  Let's add to the docs to help newbies evade this problem.

* Tweak wording

(cherry picked from commit fc302494b7)
2017-01-23 17:19:23 +00:00
Ragnar Þór Valgeirsson
d8700e8d4e Match eslint's line length settings (#8845)
(cherry picked from commit 09b3ec5d3c)
2017-01-23 17:19:23 +00:00
SunHuawei
5a25a05a7d Fix a typo (#8580)
(cherry picked from commit 5494b267d9)
2017-01-23 17:19:22 +00:00
EugeneGarbuzov
d66b82cb74 Corrected a typo. (#8837)
shoud -> should
(cherry picked from commit 30c7c4fbe6)
2017-01-23 16:10:57 +00:00
Keyan Zhang
23ad42d1ff Add "Handling Multiple Inputs" to Forms doc (#8552)
* added "Handling Multiple Inputs"

* renamed and added a codepen

* simplified the example

(cherry picked from commit 06399b8ce3)
2017-01-18 12:45:34 -06:00
Rohan Nair
4ca6885368 Updating Thinking in React doc to replace refs with event handlers (#8815)
* Updating Thinking in React doc to replace refs

* Updating doc copy to reflect changes to example

(cherry picked from commit 5d96162b57)
2017-01-18 12:45:34 -06:00
Faheel Ahmad
632b53edde I -> we (#8817)
(cherry picked from commit c8a41672ed)
2017-01-18 12:45:34 -06:00
DQNEO
153c683120 use an easier word (#8809)
* use an easier word

The word `mandatory` is relatively difficult for people with ESL (English as a second language), so I propose an alternative word.
This would be much easier to understand.

* use simpler word

(cherry picked from commit 6308238498)
2017-01-18 12:45:33 -06:00
Jack Cross
5446c47c1d Add Flow reminder to PR template (#8805)
* Added flow to PR template

* Added record-tests step to PR template and contribution docs

* Updated order of PR checks

(cherry picked from commit bfd5b1878e)
2017-01-18 12:44:25 -06:00
Rich Harris
3e5210342a add docs for building with Rollup (#8799)
* add docs for building with Rollup

* Tiny unrelated fix

(cherry picked from commit e69ff955f4)
2017-01-18 12:27:57 -06:00
Superlaziness
2b63c668ec fix HOC doc (#8802)
(cherry picked from commit 66540fdf16)
2017-01-18 12:26:44 -06:00
Vladimir Tikunov
63084d78a4 Remove error ref to the 'render' function (#8781)
What is the `render` function of a functional component?
(cherry picked from commit ebd83e809e)
2017-01-18 12:26:32 -06:00
Iurii Kucherov
6d0c155ea6 Update higher-order-components.md (#8780)
(cherry picked from commit 20c4aac9ec)
2017-01-18 12:26:22 -06:00
Whien
7d07e8118f move blog post [Profiling Components with Chrome Timeline] into docs article (#8680)
* move blog post into docs article

* move to second section and changed description

* Minor tweak

(cherry picked from commit 3ec1da800d)
2017-01-12 16:02:48 +00:00
Snowmanzzz(Zhengzhong Zhao)
638c50734b Update handling-events.md (#8762)
* Update handling-events.md

* Update handling-events.md

(cherry picked from commit 2cb7637607)
2017-01-12 16:02:48 +00:00
Tomáš Hromada
862f877c76 Added more info about refs in the documentation (#8707)
* Update refs-and-the-dom.md

I want to propose some changes to the Refs and the DOM documentation page.
- Make it clear that string refs are legacy. It seems that this information got lost during the transition to new docs and only some part stayed the same, which was confusing when first reading the docs.
- Clarify and explain that during render, if the ref callback is provided, it will get called twice, first with `null` and then with the rendered DOM element. Discussed in https://github.com/facebook/react/issues/4533 and first proposed docs change in PR #8333.

I've also planned on adding an example for passing the refs up the component chain based on something I've needed to solve myself (e.g. you want to connect two dynamic components by line in React, so you need to both use refs and propagate them up the chain), and while it would be great to read up on this in the docs, it may be too specific for this section; I'd be happy to hear any recommendations.

* Adds more specific information about the callback

* Moved the ref callback description to the Caveats section

* Fixed suggested nits

* Replace 'each render pass' with 'updates'

* Tweak the wording

(cherry picked from commit 4a7e06bab7)
2017-01-12 16:02:47 +00:00
Dmitry Zhuravlev-Nevsky
900f0acd81 Fix single vs plural (#8738)
Maybe it's not very important, just misprint fix
(cherry picked from commit 280bcfa9f5)
2017-01-12 16:02:47 +00:00
Spen Taylor
7afcf8fab0 [Docs] Replace 'mix in' in PureComponent notes (#8730)
* [Docs] Replace 'mix in' in PureComponent notes

* Style nit

(cherry picked from commit c3ce14a373)
2017-01-12 16:02:47 +00:00
Dmitry Zhuravlev-Nevsky
fe20276c43 Swap components (#8735)
It's better to delare component before using.
(cherry picked from commit 65bf19029d)
2017-01-12 16:02:47 +00:00
Richie Thomas
9b0301345b Remove one extraneous backtick from line 116 of 'codebase-overview.md' (#8724). (#8726)
(cherry picked from commit b2cc91e83a)
2017-01-09 14:58:40 -06:00
Stuart Harris
6bfdda4c5b Added React London conference, March 28th (#8722)
Thanks :-)
(cherry picked from commit c78e403d7b)
2017-01-09 14:58:40 -06:00
Nik Nyby
eddb899050 docs: add missing period in shouldComponentUpdate doc (#8720)
(cherry picked from commit fa4f79f9fc)
2017-01-09 14:58:40 -06:00
Bruno Heridet
acea663034 docs(hoc): fix typo Rambda → Ramda (#8712)
(cherry picked from commit 00846fd3a6)
2017-01-09 14:58:40 -06:00
Dan Abramov
072b51c7df Update React version in docs 2017-01-06 20:12:35 +00:00
Dan Abramov
03464f06d2 15.4.2 2017-01-06 19:52:54 +00:00
Dan Abramov
d9fb825c63 Add 15.4.2 changelog 2017-01-06 19:51:02 +00:00
Dan Abramov
7066669f5d Update shrinkwrap 2017-01-06 19:50:44 +00:00
Dan Abramov
61a922a642 Merge branch '15-dev' into 15-stable 2017-01-06 19:39:14 +00:00
Dan Abramov
4294a7c908 Fix AMD and Brunch issues (#8686)
* Add manual build fixtures

* Inject ReactDOM into ReactWithAddons from ReactWithAddons

We used to read ReactDOM as a global inside ReactAddonsDOMDependenciesUMDShim.
This didn't work in AMD environments such as RequireJS and SystemJS.

Instead, I changed it so that ReactDOM gets injected into ReactWithAddons by ReactDOM itself.
This way we don't have to try to require it (which wouldn't work because AMD doesn't handle circular dependencies well).

This means you have to load ReactDOM first before using ReactDOM-dependent addons, but this was already the case before.

This commit makes all build fixtures pass.

* Memoize ReactDOM to avoid going into require on every access

* Add Brunch fixture

* Inline requires to work around Brunch bug

See #8556 and https://github.com/brunch/brunch/issues/1591#issuecomment-270742503 for context.
This appears to be a Brunch bug but we can keep a temporary fix until the next major.

(cherry picked from commit ca2c71c0c5)
2017-01-06 17:24:23 +00:00
Ben Alpert
d2039d7fac Improve error messages for invalid element types (#8612)
(cherry picked from commit eca5b1d48e)
2017-01-06 17:04:29 +00:00
dfrownfelter
d93cedad7f Delete fiveArgumentPooler (#8597)
(cherry picked from commit b106ca0c8e)
2017-01-06 16:59:06 +00:00
Brian Vaughn
b2ce4125f6 Merge pull request #8594 from bvaughn/dont-warn-about-getInitialState-on-class-if-state-set
Don't warn about class components using getInitialState if state is set
(cherry picked from commit 3c6d4bacdd)
2017-01-06 16:58:50 +00:00
Kurt Weiberth
3ec576ec1d add dependencies to react-test-renderer and react-addons (#8467)
**What** and **Why**:

* When using npm version 2, `object-assign` and `fbjs` were not getting properly installed
* This PR adds `object-assign` and `fbjs` as explicit dependencies to both `react-test-renderer` and `react-addons`
(cherry picked from commit 7cd26024ce)
2017-01-06 16:58:22 +00:00
Ben Alpert
5216190247 Update release checklist (#8389)
(cherry picked from commit a98e8227b8)
2017-01-06 16:58:22 +00:00
Eoin Hennessy
c9a8c128bb Refactor precacheChildNodes slightly (#8018)
This ‘fixes’ a bizarre IE9 script engine issue. #7803
(cherry picked from commit 6ce8f1f93c)
2017-01-06 16:58:22 +00:00
Brandon Dail
4dd625a93f Correctly render placeholder for textarea in IE11 (#8020)
* Check if textContent should be set for textarea

shouldSetNodeTextContent returns whether a node.textContent should be
updated. Currently it only covers one case, which is to avoid setting
the textContent if the text is empty and a placeholder exists.

* Only set node.value if it's equal to initialValue

In IE11 textContent is populated when the placeholder attribute is set.
Without this check, we end up setting node.value equal to the
placeholder text, causing the textarea to actually render with the text
inside.

This check makes sure that textContent is equal to our expected
initialValue, which should be the case when using defaultValue.

* Remove placeholder/textarea check, use contentToUse instead

(cherry picked from commit e644faa610)
2017-01-06 16:58:22 +00:00
Diego Muracciole
278409db05 Injected Host Component classes are not being considered by the reconciler (#8050)
* Consider Host Component classes when creating a new internal instance

* Remove unused tagToComponentClass & injectComponentClasses from ReactHostComponent

(cherry picked from commit 461a74115c)
2017-01-06 16:58:21 +00:00
Nathan Hunzaker
ed760d1567 Fix uncontrolled input decimal point "chopping" on number inputs, and validation warnings on email inputs (#7750)
* Only assign defaultValue if it has changed.

* Improve comment about reason for defaultValue conditional assignment

(cherry picked from commit 0d20dcf910)
2017-01-06 16:58:21 +00:00
Piotr Czajkowski
2bbf07b25e "Don't Mutate the Original Component" example and description mismatch (#8695)
(cherry picked from commit df0d2a5106)
2017-01-06 15:06:13 +00:00
Piotr Czajkowski
5cdd66700b Higher-Order Components docs withSubscription() example fix (#8694)
(cherry picked from commit a52db12abf)
2017-01-06 15:06:13 +00:00
Dan Abramov
8b51d9ec73 Bump React version on website 2017-01-04 17:59:06 +00:00
Dan Abramov
1f56a6d5c9 Replace Starter Kit with doc link (#8682)
* Replace Starter Kit with doc link

* https in Babel link
2017-01-04 17:52:12 +00:00
Andre Giron
4482da4833 Fix typos (#8632)
* Fix typos

* Put back x in Latinx
2017-01-04 17:37:43 +00:00
Joel Sequeira
a824fbfd08 Fix typo in Proposing a Change section in how-to-contribute.md (#8498)
* Fix typo in Proposing a Change section in how-to-contribute.md

Not sure if it was actually intended or was a typo but changed 'If you intend to change to the public API' --> 'If you intend to make a change to the public API'

* Simplify
2017-01-04 17:30:16 +00:00
Mateusz Burzyński
013c71ae63 [Docs] Fixed anchor links in Animations section (#8453) 2017-01-04 17:24:35 +00:00
Van der Auwermeulen Grégoire
0741d52cd7 Update state-and-lifecycle.md (#8424)
* Update state-and-lifecycle.md

Isn't  clock state and props the same in this example?

* Clarify
2017-01-04 17:19:09 +00:00
Devinsuit
fc3999af09 Update blog post link (#8421) 2017-01-04 17:16:26 +00:00
Mojtaba Dashtinejad
62565a77c0 [docs] Add a note about componentWillReceiveProps (#8234)
* Component Lifecycle In Depth documentation

* first steps to improve react component reference

* improved react component reference

- remove the component-lifecycle-in-depth

* add a note for usage of ReactDOM.findDOMNode

* one note on componentWillReceiveProps

* remove old useless images for lifecycle docs

* Tweak wording
2017-01-04 16:26:59 +00:00
Karthik Chintapalli
5089fb723e Fixed stray text appearing on top of the navbar at small screen sizes (#8681) 2017-01-04 16:14:38 +00:00
Brian Vaughn
da45303c18 Merge pull request #8679 from bvaughn/fix-react-conf-2017-name
Renamed React.js Conf to React Conf in conferences.md
2017-01-04 16:14:20 +00:00
Brian Vaughn
e1b71fbc54 Merge pull request #8674 from neeldeep/patch-1
Update conferences.md
2017-01-04 16:13:58 +00:00
Brian Vaughn
4bfa07a929 Merge pull request #8671 from bonham000/update-docs
update to codebase-overview.md
2017-01-04 16:13:22 +00:00
gitanupam
76e80fe630 Changed webpack's hyperlink (#8650)
..to point to 2.x documentation instead of 1.x (and to be consistent with other links on the page)
2017-01-04 16:12:17 +00:00
gitanupam
7807354bfd 'npm init' needed before installing react via npm. (#8649)
* 'npm init' needed before installing react via npm.

I was trying to install react in my django project directory and was getting warnings about package.json not being present. Started this SO post (http://stackoverflow.com/questions/41340909/npm-cant-find-package-json-when-installing-react/41340975#41340975) to figure it out. I think it'll be useful to others too if we add it in the documentation itself.

* Tweak instructions
2017-01-04 16:11:53 +00:00
Eric Pitcher
b186e3c87e Update conditional-rendering.md (#8636)
Stating the fact that component lifecycle methods will still fire as normal even though you return null from the render method.
2017-01-04 16:10:31 +00:00
Dan Abramov
283a57a3df Consistent CodePen links in docs 2017-01-04 16:10:23 +00:00
comerc
03b08b2c3b Fix casing typo in jsx-in-depth.md (#8542) 2017-01-04 16:03:35 +00:00
lucas
a874d36015 Add return to render 2017-01-04 16:02:10 +00:00
Jacob Lamont
ea392b914f Update reference-react.md 2017-01-04 16:01:37 +00:00
Dan Abramov
569340c6ad Nitpick: use FB style in doc 2017-01-04 15:59:25 +00:00
Chris
d8b3f2d7e4 update example to use this.state (#8425)
- In the previous example, the code works even without using bind(this) in the constructor.
- the reason being handleClick doesn't even use `this` and its just calling the global function alert.
- this change make use of this via access this.state.
2017-01-04 15:57:43 +00:00
Fatih
b9c1ee97e9 fix typo 'miss-configured' to 'misconfigured' (#8412) 2017-01-04 15:56:28 +00:00
brillout
51833bec14 remove dead link (#8411) 2017-01-04 15:56:06 +00:00
Richard Maisano
73e135d013 Add a couple missing SVG tags to DOM Elements docs (#8383)
My first contribution to React!

While upgrading a React project, I found some suspect SVG that needed updating, so I dug in after checking the docs. I knew that support for some SVG properties had been added (namely `xmlns` and `xmlnsXlink`), but I noticed them missing from the reference's attribute list. This pull request updates `reference-dom-elements.md` by adding said properties.
2017-01-04 15:55:47 +00:00
cloudy1
e453eebe3f Update tutorial.md (#8328)
* Update tutorial.md

fix "unknown: Unexpected token" in "codepen.io".

* tweaks per suggestion
2017-01-04 15:54:57 +00:00
Andrew Clark
282cf7d706 Add a document on higher-order components (#7869) 2017-01-04 15:54:19 +00:00
Liz
224d21ea3d 👏 designers are friends, not fodder for jokes (#8523)
(cherry picked from commit 17f8e947fb)
2016-12-07 15:43:34 -08:00
Ben Alpert
0846c9d221 Merge branch '15-dev' into 15-stable 2016-11-22 17:58:23 -08:00
Ben Alpert
2cabb02098 docs update for v15.4.1 2016-11-22 17:56:04 -08:00
Ben Alpert
2075139ce5 15.4.1 2016-11-22 17:47:12 -08:00
Ben Alpert
20b4399d5d 15.4.1 changelog 2016-11-22 17:47:11 -08:00
Ben Alpert
bf16d23d81 shrinkwrap 2016-11-22 17:34:20 -08:00
Ben Alpert
027d8808b7 Stopgap fix for element disabling (#8387)
Fix for #8308. This is a bad hack -- EventPluginHub.getListener isn't even DOM-specific -- but this works for now and lets us release 15.4.1.
(cherry picked from commit c7129ce1f0)
2016-11-22 17:34:20 -08:00
Paul O’Shannessy
24ffd57dfa Fix browser bundle for AMD (#8374)
* Fix browser bundle for AMD

* Final fix for standalone browser build.

Much more scientific than the rest so it should stick.

* Throw when we can't find code we need to replace.

(cherry picked from commit a3ba48bf72)
2016-11-22 17:24:29 -08:00
Dan Abramov
9941c48914 Restructure code to work around a Rollup bug (#8384) 2016-11-22 17:16:13 -08:00
Paul O’Shannessy
76e67908ce Merge remote-tracking branch 'upstream/15-stable' into 15-dev 2016-11-22 11:14:05 -08:00
Mikhail Osher
91676a619a Fix object spread operator (#8378)
Object spread operator performs shallow copy of object's arguments, so it should be placed before new properties are assigned.
2016-11-22 15:54:22 +00:00
Simen Bekkhus
65f9d2ae9e Fix link to PureComponent in docs (#8375) 2016-11-22 15:54:11 +00:00
Michael Sinov
33070fb881 update react-without-es6.md (#8351) 2016-11-19 18:19:50 +00:00
Dan Abramov
3c8b63ea6c Merge pull request #8346 from shubheksha/docs/improve-state-and-lifecycle
Improved sections of state and lifecycle docs
2016-11-19 18:07:42 +00:00
Dan Abramov
01a445a418 Merge pull request #8345 from shubheksha/docs/improve-introducing-jsx
Improved some sections of the introducing JSX docs
2016-11-19 18:07:22 +00:00
Dan Abramov
a74116c82c Merge pull request #8339 from nolanlawson/patch-1
Update 2016-11-16-react-v15.4.0.md
2016-11-18 13:01:27 +00:00
Dan Abramov
f8ef2e4efe Merge pull request #8335 from lacker/newlink
add link to useful doc
2016-11-18 13:01:15 +00:00
Dan Abramov
a884bca7a1 Merge pull request #8332 from gaearon/prod-dev
[Docs] Expand Installation and clarify why use bundlers
2016-11-18 13:00:59 +00:00
Dan Abramov
a484f30bc5 Tweak examples 2016-11-17 14:45:51 +00:00
Marcy Sutton
e0cf1e0ae7 fix(a11y): add missing labels to forms doc
Showing how to create a form without labeling inputs is an accessibility anti-pattern. This change adds labels to the examples to address that. Codepen may still need to be updated depending on how that example is created.
2016-11-17 14:45:44 +00:00
Kevin Lacker
eb1077bc4c include the version number in the header (#8315) 2016-11-17 14:35:35 +00:00
Tanner
d7db851253 Remove spread operator (#8273)
* Remove spread operator

I believe what was meant here was to express that you would create the new player object with all the previous properties of the existing player object in addition to now updating the score value. That being said, this is a simple example, and the player object clearly has no other values. Objects are not (by default) iterable using this operator, so this little piece does more harm than good. I believe the new example to be much clearer.

* Using Object.assign()

* Tweak wording
2016-11-17 14:35:21 +00:00
Dave Voyles
d220385c53 Clarity on constructor of Board object for tutorial.md (#8224)
* Update tutorial.md

Is it possible to be more clear here?
 This implies that we are removing the constructor from GAME, and not board (which is what I believe the author is trying to say).
It took me several reads to understand. 

With this edit, it is now clear that the adjustment is being made to -Board- and not to -Game-

* also remove "for Board earlier"
2016-11-17 14:35:04 +00:00
Brandon Dail
04447d302c Merge pull request #8277 from qiuyuntao/master
docs: delete unnecessary brackets
(cherry picked from commit 024f62ecfe)
2016-11-16 15:22:39 +00:00
Brandon Dail
14089c9360 Update reference-react-dom.md (#8285)
Add missing closing bracket
(cherry picked from commit cdcbf2f39b)
2016-11-16 15:22:39 +00:00
Samuel Scheiderich
83efef15f3 Add freenode #reactjs link to support.md (#8270)
* Add freenode #reactjs link to support.md

* Changed irc link to http webchat link.

(cherry picked from commit 9d201918bf)
2016-11-16 15:22:39 +00:00
Michele Bertoli
881254182e Make the Shallow Rendering example clearer (#8269)
* Make the Shallow Rendering example clearer

I was reading through the documentation, and I found that the `render` call on the `renderer` was missing.

* Use a regular function to define MyComponent

(cherry picked from commit 53e45e78e4)
2016-11-16 15:22:39 +00:00
Shuhei Kagawa
04f1fe7fbf Correct a method param in Implementation Notes (#8252)
(cherry picked from commit fa4710fe51)
2016-11-16 15:22:39 +00:00
Arni Fannar
5f55b8aaf7 Update refs-and-the-dom.md (#8250)
Since a lot of projects use [airbnb eslint config](https://www.npmjs.com/package/eslint-config-airbnb) where [this rule](http://eslint.org/docs/rules/no-return-assign) is enabled (and its a good rule) some people might get confused when they are trying this out in their project.
(cherry picked from commit f4059e5e5b)
2016-11-16 15:22:39 +00:00
Guilherme Oenning
e5e387da9e fix broken docs links (#8163)
* fix broken links to outdated code

* another broken links to outdated code

* update hash commit & folder structure to current

(cherry picked from commit b847226ec4)
2016-11-16 15:22:38 +00:00
Ville Immonen
bda773c963 Remove string ref from function component example (#8244)
Refs can't be attached to stateless functional components.
(cherry picked from commit 3668a2e678)
2016-11-16 15:22:38 +00:00
Nate
2f7e6c3a5d Fix typos in Shallow Rendering Documentation (#8226)
* Fix typos in Shallow Rendering Documentation

* Fix another occurrence

(cherry picked from commit 2317fcaccb)
2016-11-16 15:22:38 +00:00
Satoshi Nakajima
b434310383 Replaced old refs with new callback refs (#8254)
(cherry picked from commit 3e708497d2)
2016-11-16 15:22:25 +00:00
Dan Abramov
550db27a1c Add 15.4.0 blog post 2016-11-16 14:49:14 +00:00
tomocchino
5ce8853ccb Update website for 15.4.0 2016-11-16 14:29:35 +00:00
tomocchino
1c1f68e8dc 15.4.0 2016-11-16 14:16:57 +00:00
tomocchino
443683525f Update Changelog & Readme for 15.4.0 2016-11-16 14:13:26 +00:00
tomocchino
88296d994d Merge branch '15-dev' into 15-stable 2016-11-16 14:08:52 +00:00
tomocchino
eee3bce748 Update error codes 2016-11-16 13:46:20 +00:00
tomocchino
6466714e4c Update dependencies / shrinkwrap 2016-11-16 13:43:33 +00:00
Brandon Dail
7df71a2525 Use _hostContainerInfo to track test renderer options (#8261)
* Use _hostContainerInfo to track test renderer options

The transaction is not available when unmounting or updating the
instance, so we track it using _hostContainerInfo

* Throw if hostContainerInfo is not populated in getPublicInstance

* Linting fixes

* Remove transaction from ref lifecycle code path

We don't need to pass the transaction around anymore since we store the
test options on _hostContainerInfo instead

* Remove unused argument

(cherry picked from commit e43aaab254)
2016-11-16 12:08:28 +00:00
Josh Perez
28e51005dc Shares debugID information across modules (#8097)
Prior to this, React was using a nextDebugID variable that was locally
scoped to both `instantiateReactComponent` and `ReactShallowRenderer`.
This caused problems when the debugIDs would collide, the `itemMap` in
`ReactComponentTreeHook` would be overwritten and tests would fail
with the message "Expected onBeforeMountComponent() parent and
onSetChildren() to be consistent".

This change shares the debugID with both modules thus preventing any
collisions in the future.
(cherry picked from commit 6eebed0535)
2016-11-16 12:07:24 +00:00
Ben Alpert
fbe19e90b9 Fix captured/bubbled in ReactNativeTreeTraversal (#8019)
Follow-up to #7741. Added a test for RN event bubbling that fails before the fix.
(cherry picked from commit a8beab3341)
2016-11-16 12:06:55 +00:00
Kevin Lacker
db0ec1ab0f forms breakup 2016-11-08 21:38:44 +00:00
Keyan Zhang
ac0c3e60fb Fix error codes (#7999)
* took codes.json from the 15-dev branch

* fixed react:extract-errors task in gulpfile

* generated error codes

* Revert "generated error codes"

This reverts commit b8f3aeed9d8f0d469edd5f6623fa6090930594d8.

* Added a README for the error code system
2016-11-08 20:26:30 +00:00
Keyan Zhang
9d8f7aed0e Fix error codes (#7999)
* took codes.json from the 15-dev branch

* fixed react:extract-errors task in gulpfile

* generated error codes

* Revert "generated error codes"

This reverts commit b8f3aeed9d8f0d469edd5f6623fa6090930594d8.

* Added a README for the error code system
2016-11-08 20:25:21 +00:00
Kevin Lacker
3fe1664601 Docs: add a bunch of redirects (#8137)
* add a bunch of redirects

* add more redirects
2016-11-08 19:32:31 +00:00
Robert Haritonov
cc3b821f66 Add React Amsterdam 2017 (#8235)
We've recently announced the dates for our next React Amsterdam edition, looking forward on adding it to the list.
2016-11-08 19:31:23 +00:00
Brent Vatne
2692cf4f03 Add Agent Conference to conferences docs (#8196)
* Add Agent Conference to conferences docs

* Move Agent Conference to upcoming conferences
2016-11-08 19:31:10 +00:00
Gant Laborde
b691f7448f Organize and add confs (#8129)
Upcoming proximity followed by past chronological.
2016-11-08 19:31:01 +00:00
Rick Beerendonk
dec8b62796 Add React Remote Conf 2016. (#8094)
Add video links to some conferences.
2016-11-08 19:30:48 +00:00
Alex Baumgertner
44550c374f Fix method markdown highlight (#8218) 2016-11-08 19:21:44 +00:00
Skasi
d7d9b81a85 Remove duplicated word in doc (#8157)
Gets rid of an obsolete word in the documentation for "State and Lifecycle":

"Consider the ticking clock example from the one of the previous sections."
->
"Consider the ticking clock example from one of the previous sections."
2016-11-08 19:21:16 +00:00
Lee Sanghyeon
d128b45c6f Update codebase-overview.md (#8142)
* Update codebase-overview.md

Fix the broken source code URL in 'Event System' section.

* Update codebase-overview.md

Re-fix link name
2016-11-08 19:20:59 +00:00
bel3atar
e2a70ac0ea add missing verb (#8139)
`why is an` should be `why it is an`
2016-11-08 19:20:28 +00:00
Andrew Lo
b062596fd4 In the community support doc, I noticed that the React Facebook (#8138)
page link is broken since it's missing '.com'.
2016-11-08 19:18:20 +00:00
Damien Soulard
5014781d21 update-unknown-warning-page - add a reason for the warning (#8131)
* update-unknown-warning-page - add a reason for this warning

* Minor tweaks
2016-11-08 19:17:03 +00:00
Eugene
923aee7cf5 Update reference-react-component.md (#8126)
line 320: For example, this code ensures that the `color` prop is a string
2016-11-08 19:14:52 +00:00
Dan Abramov
04ebe6d8c1 Clarify how transition props work (#8124) 2016-11-08 19:14:34 +00:00
Ivan Zotov
445ded0e3b Improve devtools image size for the tutorial (#8114) 2016-11-08 19:14:14 +00:00
Andreas Möller
de4c0127ad Fix: Remove unneeded else branches from documentation examples 2016-10-27 13:15:50 +01:00
Lewis Blackwood
48949f35c5 Correct usage of formatName() function in docs (#8122)
The code section above these changes defines a `formatName` function
that expects a parameter `user`. The code section containing these
changes incorrectly called `formatName(user.name)`. For those following
along with CodePen, this section should correctly call
`formatName(user)`.
2016-10-27 13:15:39 +01:00
Varun Bhuvanendran
a8fc7d80e2 added word break (#8120) 2016-10-27 13:15:26 +01:00
王晓勇
ceb282a46d Update forms.md (#8121) 2016-10-27 13:15:11 +01:00
Dan Abramov
1668ccb2b0 Tweak Forms 2016-10-27 02:02:14 +01:00
Eric Nakagawa
95cf873e53 Docs update - Additional (#8115)
* Reapplied fixes to updated docs from master

* Reapplied fixes to Forms, removed ES2016 function includes()

* Missing carriage return

* Adding back some line breaks

* Making requested changes.

* Making space changes

* Fixed typo and removed unnecessary hyphen.

* Reworded select, and highlighted line

* Fixed string styles

* Refactored <label> to use htmlFor

* Another refactor of <label>

* Removed name prop from radiobutton
2016-10-27 01:11:31 +01:00
Eric Nakagawa
7d5498de1b Forms Update (#8112)
* Reapplied fixes to updated docs from master

* Reapplied fixes to Forms, removed ES2016 function includes()

* Missing carriage return

* Adding back some line breaks

* Making requested changes.

* Making space changes
2016-10-27 01:11:00 +01:00
Alex Katopodis
e2c648e93c Fix typo in reconciliation.md (#8110) 2016-10-27 01:10:30 +01:00
Lutz Rosema
ca8ddfda02 Use const instead of var (#8107)
It clarifies that `history` and `current` won't be reassigned.
2016-10-27 01:10:15 +01:00
Toru Kobayashi
a53e45ada0 Fix an argument name of TestUtils.renderIntoDocument (#8104) 2016-10-27 01:09:47 +01:00
Jae Hun Lee
c07ed1a498 Update lists-and-keys.md (#8090)
There is mismatching variable name both definition and usage.
In line 156, an argument name called item is change to match the usage in line 158.
2016-10-27 01:09:23 +01:00
Constantin Gavrilete
f87407034d removed duplicated 'the' (#8081) 2016-10-27 01:09:04 +01:00
Dan Abramov
6f26178a3a Add more highlighting to docs (#8076)
* Tweak JSX in Depth

* Add highlighting to Refs and the DOM

* More tweaks
2016-10-24 15:53:09 +01:00
Ashish
7480eb2317 Docs : Fix createClass reference (#8073)
Currently react.createClass is wrongly referenced to #react.createclass. Changed it to #createclass!
2016-10-24 15:52:57 +01:00
Marcio Puga
933898b457 Fix typos (#8067) 2016-10-24 15:52:46 +01:00
Dan Abramov
5d08b299a7 Remove references to createClass in createElement docs (#8064) 2016-10-23 15:49:07 +01:00
Dan Abramov
6165c49f1d Link to lifecycle methods from Context doc (#8062) 2016-10-23 14:35:40 +01:00
Giuseppe
20587a4733 Docs replace reference to 'getInitialState' with 'state' instance property in "Thinking in React" (#8059) 2016-10-23 13:52:19 +01:00
Andrew Poliakov
6a89bc9be0 Update tutorial.md, Taking Turns (#8058) 2016-10-23 13:52:00 +01:00
Alireza Mostafizi
ba488ce64f Update handling-events.md (#8057) 2016-10-23 13:51:48 +01:00
William Hoffmann
b06fd4b36d Fix typo (#8056) 2016-10-23 13:51:31 +01:00
Jun Kim
2d37da10db Fix illogical code in tutorial.md (#8048)
The tutorial wants to throw a 'warning' and explains about 'key' of React's list, but it throws nothing since there is sensible key.
"key={move}" should be removed, and added after explaining about key.
2016-10-23 13:51:04 +01:00
Jason Grlicky
b46d90e09d Fix for typos (#8046) 2016-10-23 13:50:51 +01:00
Ben Alpert
4b11e25746 Update website on Travis when only new files are added (#8037)
This build didn't commit the new files because no existing files were changed:

https://travis-ci.org/facebook/react/jobs/169622664

This should work better.
2016-10-22 22:09:23 +01:00
Christopher Chedeau
1d74e43b2c Update components-and-props.md
fb indent style
2016-10-22 22:08:36 +01:00
Christopher Chedeau
27ce7a9151 Update react-without-jsx.md
Facebook codestyle
2016-10-22 22:08:27 +01:00
Oskari Mantere
a9578c9d5b Replace vars with let and const (#8051) 2016-10-22 22:07:23 +01:00
Jun Kim
b82f13546f Fix typo in tutorial.md (#8047)
changges -> changes
2016-10-22 22:07:06 +01:00
Taeho Kim
3979c734a2 Fix typo in new tutorial code (#8045) 2016-10-22 22:06:54 +01:00
Nathan Hardy
24f27f81a5 Fix erroneous '}' in JSX examples (#8043) 2016-10-22 22:06:41 +01:00
Sebastian Markbåge
9c7d8a941d Fix relative link in Hello World (#8041)
* Fix relative link in Hello World

This links https://facebook.github.io/docs/installation.html which redirects to https://code.facebook.com/

* Update hello-world.md

* Fix link
2016-10-22 22:06:23 +01:00
Cody Reichert
f05fe34a85 Fix anchor link for displayName (#8040) 2016-10-22 22:06:10 +01:00
Ragnar Þór Valgeirsson
ea6c7f4edb Convert the Number component to ListItem (#8039)
* Convert the Number component to ListItem

* Add updated example CodePen

Also fixes typos.
2016-10-22 22:05:53 +01:00
BEAUDRU Manuel
a7cb3ace36 Wrong library name reference in tutorial.MD (#8038)
* Update tutorial.md

Seems like you are talking about immutable.js and not immutability.js which doesn't exist :)

* Capitalize Immutable.js
2016-10-22 22:05:40 +01:00
Piper Chester
89defaa712 Fix grammatical error 2016-10-22 22:05:15 +01:00
Phil Quinn
24dd09fea7 correct order of params in documentation (#7989) 2016-10-22 22:04:36 +01:00
CT Wu
1d108d8f6a Fix a typo in the doc (#7969) 2016-10-22 22:04:13 +01:00
Dan Abramov
60ec3c6b37 Fix redirects 2016-10-21 22:01:06 +01:00
Dan Abramov
55a788e756 Minor doc tweaks 2016-10-21 21:47:57 +01:00
Kevin Lacker
1cf81c1aa9 New Documentation 2016-10-21 21:00:10 +01:00
Sebastian Markbage
457730dded 15.4.0-rc.4 2016-10-14 14:56:30 -07:00
Sebastian Markbåge
d81d9e260f Fix whitespace in headers (#7980)
The script that strips providesModule is very sensitive.

Test plan:

Searched for providesModule in build. No more.

reactComponentExpect used to have problems too but doesn't seem
to anymore. Don't know why.
2016-10-14 14:52:04 -07:00
Dan Abramov
c577b82875 15.4.0-rc.3 2016-10-14 19:56:21 +01:00
Dustan Kasten
2d049e8df6 build: strip @providesModule from output modules (#7968)
FB tools such as Flow and Jest are having issues finding duplicate modules
now that React internal modules are duplicated across packages.
2016-10-14 19:54:15 +01:00
Alex Babkov
cd65b60960 Typo fixes in codebase-overview.md (#7938) 2016-10-11 12:09:33 +01:00
Aesop Wolf
b52288cbcf Update codebase-overview.md (#7934)
Fix typo
2016-10-11 12:09:20 +01:00
Colin Wren
4327cde28b Fix typo in more-about-refs.md (#7933) 2016-10-11 12:09:04 +01:00
Sophia
08c320d047 removing parent/child references in props section of tutorial (#7887) 2016-10-11 12:08:41 +01:00
Dan Abramov
2b5c43029e Add Implementation Notes and amend Codebase Overview (#7830)
* Add more to Codebase Overview

* WIP

* Start a reconciler overview

* Add a few more sections

* todo

* WIP

* Finish it

* Whitespace

* Minor tweaks

* Minor tweaks
2016-10-10 17:30:18 +01:00
Paul O’Shannessy
c8c879f1c5 15.4.0-rc.2 2016-10-05 15:45:23 -07:00
Paul O’Shannessy
a107f6d12e Fix npm package builds (#7888)
* Ensure lib/ is packaged for react-test-renderer

* Run npm pack from right working directory

We were running this on the original packages not the compiled ones, resulting in missing files

(cherry picked from commit 077d660a27)
2016-10-05 15:41:25 -07:00
Paul O’Shannessy
4717d2480c 15.4.0-rc.1 2016-10-04 15:33:38 -07:00
Brandon Dail
91dc94cec6 Resolve Flow & Test issues with ReactTestRenderer
This is a manual cherry-pick of 2 PRs, updated to handle differences in the stable branch:
- c78464f8ea - Resolve flow errors with ReactTestRenderer (#7736)
- 7dfa01f9fa - Revert ReactMultiChild to plain object (#7757)
2016-10-04 15:22:03 -07:00
Michael O'Brien
1f605930cc Update comment to refer to correct method name (#7873) 2016-10-04 22:53:49 +01:00
Toru Kobayashi
c7020c017d Fix confusing variable names (#7863)
(cherry picked from commit 30067fa8ca)
2016-10-04 14:27:21 -07:00
Toru Kobayashi
9b025df36b Refactor ShallowRenderer (#7739)
* Separate ReactShallowRenderer from TestUtils

* Use ES classes to ReactShallowRenderer

(cherry picked from commit 85b0377bfd)
2016-10-04 14:27:21 -07:00
Dan Abramov
b0b1303207 Fix benchmarks (#7704)
(cherry picked from commit 3fcba2044a)
2016-10-04 14:24:24 -07:00
Ben Alpert
4f20847f8b Make benchmark script work in React 15
(cherry picked from commit cab835d3a0)
2016-10-04 14:23:45 -07:00
Ben Alpert
3e95d99fe2 Interleave trials in benchmark script
This should be more of a fair A/B test so the timings aren't affected by having different load on your system when testing the two alternatives.

(cherry picked from commit c0007d56e9)
2016-10-04 14:21:18 -07:00
Paul O’Shannessy
1dce444f70 Fix UMD bundles, making safe to use as required modules (#7840)
(cherry picked from commit 92c84a6f37)
2016-10-04 14:02:23 -07:00
hkal
4dfe234950 Add unknown property warning for use of autofocus (#7694)
(cherry picked from commit f6fdfd1bf0)
2016-10-04 14:02:23 -07:00
Mark Penner
8ecaaddd23 Fixes #7824 (#7832)
(cherry picked from commit dae3043897)
2016-10-04 14:02:22 -07:00
J. Renée Beach
a793486541 React dom invalid aria hook (#7744)
* Add a hook that throws a runtime warning for invalid WAI ARIA attributes and values.

* Resolved linting errors.

* Added a test case for many props.

* Added a test case for ARIA attribute proper casing.

* Added a warning for uppercased attributes to ReactDOMInvalidARIAHook

(cherry picked from commit 59ff7749ed)
2016-10-04 14:02:22 -07:00
Christopher Chedeau
6b85431df6 Fix total count in flow tracker (#7813)
When you put the output of a bash command in a variable, it replaces the `\n` with a space. Using `ls` instead of `echo` fixes it

Test Plan:
Run

```
ALL_FILES=`find src -name '*.js' | grep -v umd/ | grep -v __tests__ | grep -v __mocks__`
COUNT_ALL_FILES=`ls $ALL_FILES | wc -l`
echo $COUNT_ALL_FILES
```

Make sure that it outputs 221
(cherry picked from commit 72ed5df5a4)
2016-10-04 14:02:22 -07:00
Christopher Chedeau
32edcfc9cd Track fiber tests (#7812)
Use the newly added tracking system to track the number of fiber tests that are passing/failing.

I first tried to modify the grunt lint rule for it and send the output in stdout but unfortunately grunt displays the rule + done messages there. I had like 30 lines of js already and I figured I could just write 3 lines of bash and it would work the same. Let me know if you want me to use another approach for it.

Test Plan:
Run the commands that have been introduced in this commit but the facts-tracker one
Run `echo $FIBER_TESTS` and make sure it prints `666/1434`
(cherry picked from commit 84f8df1f89)
2016-10-04 14:02:22 -07:00
Christopher Chedeau
a28dc34918 Update travis.yml to use $GITHUB_USER_NAME and $GITHUB_USER_EMAIL (#7811)
See https://github.com/facebook/react/pull/7747#issuecomment-249677880 for discussions
(cherry picked from commit fb1e7075ed)
2016-10-04 14:02:22 -07:00
Christopher Chedeau
3135f888f0 Introduce facts-tracker (#7747)
* Introduce facts-tracker

We want to be able to track various things like number of files that are flowified, number of tests passing with Fiber...

This introduces a tool that lets you do that. The API is very simple, you execute the script with a list of tuples [key value] and it's going to create a `facts` branch and put a txt file for each fact and values over time.

```
node scripts/facts-tracker/index.js \
  "flow-files" "$COUNT_WITH_FLOW/$COUNT_ALL_FILES"
```

Test Plan:
This is tricky to test because Travis only exposes the private variables (github token) when it processes a committed file and not on branches. The reason is that otherwise anyone could send a pull requests that does `echo $GITHUB_TOKEN` and steal your token.

Given this constraint, I did all the work using two of my repos:
- https://github.com/vjeux/facts-tracker
- https://github.com/vjeux/facts-tracker-test

and am sending this pull request that should work as is /fingers crossed/, but we won't be able to test it out until it is committed.

Note that once this lands, I'm going to kill those two repos.

* Update with all the suggested changes

* Branch on a flow type in travis.yml

* Use $GITHUB_TOKEN

* properly escape it

(cherry picked from commit dbd9c4b205)
2016-10-04 14:02:22 -07:00
Andy Edwards
84fc62f30f Clarify manual PropType calls warning (#7777)
(cherry picked from commit b7c70b67af)
2016-10-04 14:02:21 -07:00
Paul O’Shannessy
c4c7e0a966 Adjust code to handle more availability of function.name (#7670)
(cherry picked from commit 00ac1797d7)
2016-10-04 14:02:21 -07:00
Uladzimir Havenchyk
918037bd30 Simplify event phases. Use explicitly 'captured' and 'bubbled'. (#7741)
(cherry picked from commit 65870dcaee)
2016-10-04 14:01:50 -07:00
Dan Abramov
5fe354bc1e Update the homepage with ES6 (#7868)
* Update the homepage with ES6

* Avoid array spread and stale state
2016-10-04 19:33:52 +01:00
Kateryna
9a9a6cf10b Fix initial state example for Recat.createClass (#7867)
In the example there was a typo with setting initial state using `getInitialState` method
2016-10-04 19:33:46 +01:00
ankitml
6ac0bbfd17 Use ES6 in Language Tooling doc 2016-10-04 12:52:01 +01:00
Marcelo Alves
75e9127216 Fix minor typo in closing H1 tag (#7855) 2016-10-04 12:23:12 +01:00
KeicaM
1d099c001f Update 04-multiple-components.md (#7861)
added missing map bracket
2016-10-04 12:20:59 +01:00
Steve Mao
ffa70704ca simplify npm link script a little bit (#7862)
We don't need to remove the folders before linking the modules
2016-10-04 12:20:49 +01:00
Paul O’Shannessy
71f0c6fef9 Update ignores in flowconfig (#7722)
This ensures we ignore relative to our project root and won't be tripped up by issues where checkouts in other places result in Flow passing when it shouldn't (eg on Travis CI where the checkout path is `/home/travis/build/facebook/react`)
(cherry picked from commit 864bc7b939)
2016-10-03 18:01:50 -07:00
Brandon Dail
a6bdb0022f Clean up ReactTestRenderer (#7716)
* create ReactTestTextComponent fil

* create ReactTestEmptyComponent

* Use class for ReactTestRenderer

* Add flow to ReactTestRenderer

(cherry picked from commit 5a3abab660)
2016-10-03 18:01:33 -07:00
Ben Alpert
1d93d28494 Unify branches in cloneFiber (#7723)
(cherry picked from commit 9eba80825f)
2016-10-03 17:58:49 -07:00
Andrew Clark
c3d43193c9 [Fiber] Animation priority work (#7466)
* High priority work

Adds the ability to schedule and perform high priority work. In the
noop renderer, this is exposed using a method `performHighPriWork(fn)`
where the function is executed and all updates in that scope are given
high priority.

To do this, the scheduler keeps track of a default priority level.
A new function `performWithPriority(priority, fn)` changes the default
priority before calling the function, then resets it afterwards.

* Rename overloaded priority terms

"High" and "low" priority are overloaded terms. There are priority
levels called HighPriority and LowPriority. Meanwhile, there are
functions called {perform,schedule}HighPriWork, which corresponds
to requestAnimationFrame, and {perform,schedule}LowPriWork, which
corresponds to requestIdleCallback. But in fact, work that has
HighPriority is meant to be scheduled with requestIdleCallback.
This is super confusing.

To address this, {perform,schedule}HighPriWork has been renamed
to {perform,schedule}AnimationWork, and
{perform,schedule}LowPriWork has been renamed to
{perform,schedule}DeferredWork. HighPriority and LowPriority
remain the same.

* Priority levels merge fix

(cherry picked from commit 6144212a86)
2016-10-03 17:58:49 -07:00
Sebastian Markbåge
da9a658e35 Merge pull request #7344 from acdlite/fibersetstate
[Fiber] setState
(cherry picked from commit 3e54b28c20)
2016-10-03 17:58:49 -07:00
Sebastian Markbåge
3bc9d9caa7 Merge pull request #7636 from sebmarkbage/fiberrefactor
[Fiber] Refactor Pending Work Phase and Progressed Work
(cherry picked from commit a19fede67c)
2016-10-03 17:58:48 -07:00
Brandon Dail
d5059c91f5 Implement createNodeMock for ReactTestRenderer (#7649)
* Implement optional mockConfig and getMockRef

* default mockConfig, walk render tree

* Pass mockConfig to transaction

* Attach mockConfig to transaction

* type mockConfig in ReactRef

* Expect object in native component ref test

* Fix argument name for attachRefs

* Add mockConfig support to legacy refs

* Pass transaction to getPublicInstance

* Implement getMockConfig on ReactTestReconcileTransaction

* Merge defaultMockConfig and mockConfig options

* Rename mockConfig to testOptions

* Break getPublicInstnce into three lines

* createMockRef -> createNodeMock

(cherry picked from commit f3569a2c31)
2016-10-03 17:58:48 -07:00
Keyan Zhang
ec4c0f1dd6 changed ReactChildrenMutationWarningHook to Object.freeze (#7455)
- only freeze children array created by createElement
(cherry picked from commit 38c4ade6cc)
2016-10-03 17:58:48 -07:00
Flarnie Marchan
4d99f2bdd4 Fix Flow errors in Event Plugins (#7698)
Due to a typo in PR#7667 where I put 'DispatchConfig' when the type was
'EventTypes', there were some flow errors being thrown.

Then PR#7642 fixed a bug in SimpleEventPlugin and added some untyped
methods, which threw more flow errors.

Last, while fixing this, I fixed two eslint errors in the
SimpleEventPlugin test.
(cherry picked from commit 54cbe29262)
2016-10-03 17:57:10 -07:00
Dmitrii Abramov
ce1f57e940 jest@15.1.1 (#7693)
(cherry picked from commit e3e03b30b2)
2016-10-03 17:57:09 -07:00
Nathan Hunzaker
2fbe0cd333 Move mouse event disabling on interactive elements to SimpleEventPlugin. Related perf tweak to click handlers. (#7642)
* Cull disabled mouse events at plugin level. Remove component level filters

* DisabledInputUtils tests are now for SimpleEventPlugin

* Add click bubbling test

* Add isInteractive function. Use in iOS click exception rules

* Invert interactive check in local click listener. Add test coverage

* Reduce number of mouse events disabable. Formatting in isIteractive()

* Switch isInteractive tag order for alignment

* Update formatting of isInteractive method

(cherry picked from commit 73c50e7d00)
2016-10-03 17:57:09 -07:00
Toru Kobayashi
747d65133a Run codemod react-codemod/transforms/class again (#7679)
ref. #7321
(cherry picked from commit df033180f0)
2016-10-03 17:57:09 -07:00
Christopher Chedeau
195b03e196 Type ReactHostOperationHistoryHook (#7672)
In order to properly type an `Operation`, we need to change the call site from having two arguments: one for `type` and one for `payload` into an object that contains both. This isn't a perf regression because we were already constructing this object in the first place and doesn't change the emitted event so shouldn't affect the dev tools.

None of the call sites are actually flow-ified so it isn't technically used but once we will, it'll make sure that we don't send random strings and payload through those very generic methods.
(cherry picked from commit eaefd9052a)
2016-10-03 17:57:09 -07:00
Christopher Chedeau
c023d53f02 Trim and inline ReactInstanceHandles (#7676)
React IDs have been killed and there was one call site left in a test. I trimmed down the implementation to keep only what is actually used and inlined it inside of the test so we don't get more people using it in the future.
(cherry picked from commit 82598eec79)
2016-10-03 17:57:08 -07:00
Flarnie Marchan
c1f0b4e9da Flow type event plugins (#7667)
* Type SimpleEventPlugin and TapEventPlugin

- Renamed file from 'ReactSynteticEvent' to 'ReactSyntheticEventType'
- Fills in the 'any' holes that were left in DispatchConfig type and the
  type annotations in EventPluginRegistry.
- Adds polymorphic PluginModule type and related types
- Uses hack to support indexable properties on 'Touch' type in
  TapEventPlugin

The issue in TapEventPlugin is that the code is accessing one of four
possible properties on the 'Touch' type native event using the bracket
accessor. Classes in Flow don't support using the bracket accessor,
unless you use a declaration and the syntax `[key: Type]: Type`.[1] The
downside of using that here is that we create a global type, which we
may not need in other files.

[1]: https://github.com/facebook/flow/issues/1323

Other options:
- Use looser typing or a '@FixMe' comment and open an issue with Flow to
  support indexing on regular classes.
- Rewrite TapEventPlugin to not use the bracket accessor on 'Touch'. I
  thought the current implementation was elegant and didn't want to
  change it. But we could do something like this:
```
 if (nativeEvent.pageX || nativeEvent.pageY) {
   return axis.page === 'pageX' ? nativeEvent.pageX : nativeEvent.pageY;
 } else {
   var clientAxis = axis.client === 'clientX' ? nativeEvent.clientX : nativeEvent.clientY;
   return nativeEvent[axis.client] + ViewportMetrics[axis.envScroll];
 }
```

(cherry picked from commit 7b2d9655da)
2016-10-03 17:57:08 -07:00
Christopher Chedeau
26d060797c I wrote it live! (#7663)
(cherry picked from commit 334b8bdf16)
2016-10-03 17:57:02 -07:00
Filip Spiridonov
118b93c591 Remove unnecessary var declaration (#7666)
(cherry picked from commit 0c77b2f3eb)
2016-10-03 17:33:04 -07:00
Dan Abramov
654829da66 Don't bundle ReactComponentTreeHook in production (#7653)
Fixes #7492.
This was a build size regression introduced in #7164.
(cherry picked from commit a09d158a7c)
2016-10-03 17:33:04 -07:00
Nathan Hunzaker
88e29060cd Use proper render method in static markup event listener test (#7652)
(cherry picked from commit 40c90a6499)
2016-10-03 17:33:03 -07:00
Paul O’Shannessy
a7b81a60c0 Flow: bool -> boolean (#7650)
(cherry picked from commit 7b247f3609)
2016-10-03 17:33:03 -07:00
Christopher Chedeau
db985af3c3 Type ReactCurrentOwner (#7648)
Simpler than ReactOwner :)
(cherry picked from commit 2559030c34)
2016-10-03 17:33:03 -07:00
Christopher Chedeau
2c16a6bb9d Convert CallbackQueue to a class (#7647)
It turns out that flow cannot type `this` with a function constructor + prototype overrides. Turning it to a class makes flow happy and has minimal impact on the output.

In open source, we already use the loose version of the class transform and internally we have one that's outputting even less code if you have `@preventMunge` in the header.

See discussion in https://www.facebook.com/groups/2003630259862046/permalink/2098480820376989/
(cherry picked from commit a70acb37d9)
2016-10-03 17:33:03 -07:00
Christopher Chedeau
b4949fd8c6 Restore coverage in Travis (#7628)
We disabled coverage in Travis because the implementation was crashing ( https://github.com/facebook/react/issues/6290 ). Since we upgraded to Jest 15, the entire coverage implementation is brand new so we should give it another try.
(cherry picked from commit 839697f60c)
2016-10-03 17:33:03 -07:00
Christopher Chedeau
206bc2a330 Type ReactRef (#7600)
Nothing out of the ordinary on this one.
(cherry picked from commit 31dd6944d3)
2016-10-03 17:33:02 -07:00
Flarnie Marchan
2c00d750c2 Merge pull request #7644 from flarnie/flowifyEventPluginRegistry
Type EventPluginRegistry
(cherry picked from commit 9a88e593ed)
2016-10-03 17:33:02 -07:00
Christopher Chedeau
ae79e023d5 Generate SimpleEventPlugin data structures at runtime (#7616)
We used to copy and paste the same big blob many times in order for it to work with keyOf which is no longer a constraint. This pull request takes a list of all the events as string and generate those data structures at runtime.

It reduces the size of React by 1k post gzip and flow is able to extract the structure out of it :)
(cherry picked from commit 1229a238c4)
2016-10-03 17:33:02 -07:00
Ben Alpert
bef7ae4800 Merge pull request #7634 from spicyj/flowfix
Small flow fixes
(cherry picked from commit 0c62d121c5)
2016-10-03 17:33:02 -07:00
Guillaume Claret
b7d7f47a5e Remove the Flow experimental.strict_type_args option (#7631)
(cherry picked from commit 355c490653)
2016-10-03 17:31:42 -07:00
Nathan Hunzaker
85de53c450 Remove String.prototype.split polyfill warning (#7629)
(cherry picked from commit 5c47920384)
2016-10-03 17:31:41 -07:00
Christoph Pojer
96d39380fa Merge pull request #7625 from vjeux/jest15
Update to jest 15
(cherry picked from commit 1bd55c8cbd)
2016-10-03 17:31:41 -07:00
Christopher Chedeau
d5a769ec89 Kill keyOf :) (#7615)
(cherry picked from commit f7076b7759)
2016-10-03 17:31:36 -07:00
Christopher Chedeau
869d26c3b4 Remove keyMirror in TopLevelTypes (#7597)
This is the last callsite of keyMirror! It removes 0.5k gzipped :)

The only trick with this one is that ReactTestUtils actually iterates over the list of all the events. Instead of duplicating the logic, I used the $Enum feature of flow that lets us statically extract out the type from the dynamic value. Inside of react-dom we're no longer requiring the file directly so it doesn't bloat the file size, and we still get to have static typing, best of both worlds!
(cherry picked from commit 2f9a9dc4c5)
2016-10-03 17:31:00 -07:00
Christopher Chedeau
c3f2c6b19d Remove keyMirror in PropagationPhases (#7596)
See rationale in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
(cherry picked from commit 738a9e3ef2)
2016-10-03 16:27:35 -07:00
Paul O’Shannessy
465d35a78a Cleanup ReactErrorUtils (#7610)
This cleans up the Flow annotations and brings the implementations in line.
(cherry picked from commit 395888435b)
2016-10-03 16:27:35 -07:00
Nick Raienko
bf3f9cffc2 Ignore bundle.js for examples (#7498)
* Ignore bundle.js for examples

* Move ignored bundle.js under examples directory

(cherry picked from commit 5331fd00bc)
2016-10-03 16:27:34 -07:00
Christopher Chedeau
4b7f7b371b Type Transaction (#7581)
This one is interesting because we have transaction objects being passed around everywhere in the codebase but there's actually no Transaction class. It's a "mixin" that comes to life by being Object.assigned to the prototype of a real "class" (before class was cool!). Therefore, we can't just say `var Transaction = require('Transaction'); (transaction: Transaction) => { }` because it would be the object that contains a mixin and not an instance of a transaction.

The trick I use is to export `TransactionType` and alias it to `Transaction` in the file as it doesn't actually require transaction. In case they do, we'll figure it out, but in the few files I looked at, it doesn't seem to be the case.

For the perform function, it actually typechecks pretty well!
(cherry picked from commit a3e576e1bb)
2016-10-03 16:27:34 -07:00
Christopher Chedeau
0dd4ff1bc8 Remove the Mixin layer of indirection on ReactCompositeComponent (#7599)
As mentioned in https://github.com/facebook/react/pull/7581#issuecomment-242952042 we can remove the Mixin layer of indirection as it only exports a Mixin and I find it confusing.
(cherry picked from commit dd0c65c6aa)
2016-10-03 16:27:34 -07:00
Christopher Chedeau
577818e419 Type PooledClass (#7578)
This one was really interesting to type as it's doing a lot of unusual JavaScript. Fortunately flow is now pretty kick ass and I've been able to mostly type it. The only missing piece is that it won't check the constructor arguments.

If you are a fb employee, you can follow the discussion here: https://www.facebook.com/groups/flowtype/permalink/1132359430146004/
(cherry picked from commit 19b8eadb24)
2016-10-03 16:27:34 -07:00
Christopher Chedeau
2589ed586d Type ReactOwner (#7587)
Incrementally type ReactInstance by adding the types of attach/detachRef.

I moved isValidOwner as a function inside of the file since it's never used externally.
(cherry picked from commit fa9869b5a0)
2016-10-03 16:27:34 -07:00
Christopher Chedeau
b9ce809aaf Type ReactMultiChildUpdateTypes (#7589)
As mentioned in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/ I'm going to kill this instance of keyMirror and use a plain string instead with a type union.

The current type union is unused right now but when I type ReactMultiChild I will use it.
(cherry picked from commit c9e03f0a85)
2016-10-03 16:27:34 -07:00
Christopher Chedeau
dd01e016a6 Remove keyMirror in SpecPolicy (#7590)
As discussed in my RFC: https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
(cherry picked from commit e3b2c6e650)
2016-10-03 16:27:33 -07:00
Christopher Chedeau
329b107606 Remove keyMirror in ComponentLifeCycle (#7591)
See rationale in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
(cherry picked from commit a35387c030)
2016-10-03 16:27:33 -07:00
Christopher Chedeau
fb7b8f201f Remove keyMirror in ReactPropTypeLocations (#7592)
This one involves a bit more work as I added "phantom" flow types to a bunch of places where the type is a ReactPropTypeLocations even though those files are not `@flow` yet.

A good side effect is that `ReactPropTypeLocationNames` keys are now correctly typed, this means that they cannot go out of sync without breaking flow :)
(cherry picked from commit 84084153ed)
2016-10-03 16:27:33 -07:00
Christopher Chedeau
74da40520c Type ReactDebugTool (#7586)
Flow doesn't really support the concept of variables that are non-null but only inside of a `__DEV__` block. There's an internal post about it ( https://www.facebook.com/groups/flowtype/permalink/1132437726804841/ ) and the conclusion is that we should force it to be non-null and trust the developer to put the proper DEV checks in place.
(cherry picked from commit 0d927844fb)
2016-10-03 16:27:33 -07:00
Christopher Chedeau
f5f0256d82 Type ReactPerf (#7585)
We need to export FlushHistory type and I submitted a PR on flow to fix the type of console.table which is too restrictive.

I'm already starting to see the benefits of flow, I can look at random variables in the code and flow knows what shape the objects are! It's really useful to try and understand what's going on :)
(cherry picked from commit 2fb5eae372)
2016-10-03 16:27:33 -07:00
Christopher Chedeau
25bdc55fb8 Type ReactDebugTool (#7576)
(cherry picked from commit c086e5f94e)
2016-10-03 16:27:33 -07:00
Christopher Chedeau
f5f1c749b6 Type ReactInvalidSetStateWarningHook (#7572)
(cherry picked from commit 09887e0311)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
951b243d17 Type ReactChildrenMutationWarningHook (#7571)
(cherry picked from commit e2ddbac35e)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
a9b2d841f7 Remove unneeded declare (#7570)
It turns out that we don't need it, flow is smart enough to realize that the function is declared in the two branches :)
(cherry picked from commit b977cf13c4)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
58d6f4fac6 Type ReactComponentEnvironment (#7566)
(cherry picked from commit f784a2d50a)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
03846d6916 Fix lint errors (#7568)
In Type ReactComponentTreeHook #7504, I merged even though travis didn't report green (travis for all the fb repos has been backlogged like crazy since this morning) by manually doing `npm test` and `npm run flow` but I didn't ensure that lint was all green.

@millermedeiros pinged me about it so here's a quick fix
(cherry picked from commit 66e77f696a)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
774a94b6c2 Type ReactComponentTreeHook (#7504)
For this one, I wanted to type a non-trivial piece of the codebase and ran into the fact that we do not have types for ReactElement nor ReactInstance, so I had to create them.

I'll add comments inline
(cherry picked from commit ea494a2c10)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
283dbc30ee Type ReactPropTypesSecret (#7501)
(cherry picked from commit 563f3bbab4)
2016-10-03 16:27:32 -07:00
Christopher Chedeau
f4374bd168 Type ReactElementSymbol (#7564)
(cherry picked from commit a72a156f58)
2016-10-03 16:27:31 -07:00
Christopher Chedeau
87958ea037 Type ReactErrorUtils (#7565)
(cherry picked from commit 03e8c0eb75)
2016-10-03 16:27:31 -07:00
Christopher Chedeau
52235eadfd Type canDefineProperty (#7500)
(cherry picked from commit 18003578b1)
2016-10-03 16:27:31 -07:00
Christopher Chedeau
cb963b09ab Type ReactPropTypeLocations (#7502)
(cherry picked from commit ad3c65186e)
2016-10-03 16:27:31 -07:00
Christopher Chedeau
1fb75eaa9e Type ReactPropTypeLocationNames (#7503)
(cherry picked from commit 7f64baad78)
2016-10-03 16:27:31 -07:00
Christopher Chedeau
a71a787038 Update flow to 0.31 (#7557)
(cherry picked from commit 08614db025)
2016-10-03 16:27:31 -07:00
Dan Abramov
cbc450860e Show React events in the timeline when ReactPerf is active (#7549)
* Show React events in the timeline when ReactPerf is active

This currently only seems to work on Chrome.

* Address Chrome issue

(cherry picked from commit 0a248ee7b9)
2016-10-03 16:27:30 -07:00
Sebastian Markbåge
ecdc185deb Use aliasify everywhere instead of browserify-global-shim (#7476)
I already had to aliasify to have better control over the requires
so we might as well do it everywhere for consistency.

This probably makes it easier to rebase the rollup work too
because aliases seems to be how you solve this in that world.
(cherry picked from commit c8f7215b20)
2016-10-03 16:23:23 -07:00
Sebastian Markbåge
cc2e5cc3d7 Require the isomorphic React instead of internals from renderers (#7473)
This is needed for flat builds. It also lets us get rid of a bunch
of special cases in the build scripts.

It also allow us to just copy the source files into React Native
instead of having to build first to resolve the special cases.
(cherry picked from commit 1c5a639c37)
2016-10-03 16:23:16 -07:00
Sebastian Markbåge
5c2a88a9a1 Build React DOM Fiber package (#7173)
This builds a `react-dom-fiber.js` bundle which exposes ReactDOMFiber.
This allows early experiments with the new Fiber reconciler.

I also expose it in the npm package through `react-dom/fiber`.
(cherry picked from commit f7e0db9a18)
2016-10-03 16:18:51 -07:00
Sebastian Markbåge
5bc9daa125 Build renderers into their individual npm packages (#7168)
This copies modules into three separate packages instead of
putting it all in React.

The overlap in shared and between renderers gets duplicated.

This allows the isomorphic package to stay minimal. It can also
be used as a direct dependency without much risk.

This also allow us to ship versions to each renderer independently
and we can ship renderers without updating the main react package
dependency.
(cherry picked from commit 0f004efce2)
2016-10-03 16:18:46 -07:00
Sebastian Markbåge
21a4e7a826 Mock ReactDOM for Fiber Tests (#7206)
We currently write all our tests against the DOM implementation.
I need a way to run the Fiber tests against it. But I don't want
to take on any package dependencies on Fiber modules yet.

There's a problem with jest right now where you can't globally
mock modules that already exist. So I have to add a global call
to jest.mock.

Luckily we already have a way to test the useCreateElement paths
using a feature flag. I won't activate this flag in travis until
it passes, but the idea is to run all three variants in travis.

I'm not sure that invoking rAF and rIC synchronously is the best
way to test this since it doesn't capture the backwards
compatibility aspect. I.e. the fact that people might be relying
on the synchronous nature in real apps too. It's a start.

Ideally, jest would have these built-in.
(cherry picked from commit c06a68a10b)
2016-10-03 16:08:28 -07:00
Sebastian Markbåge
556bd43a26 Include React itself in the list of shims (#7453)
Without this we end up bundling all of the isomorphic React into
the DOM bundle. This was fixed in #7168 too but I'll just do an
early fix to ensure that #7168 is purely an npm change.
(cherry picked from commit ca9167c202)
2016-10-03 16:08:28 -07:00
Sebastian Markbåge
8426fafe90 Fix trailing build issues (#7450)
Use relative path for addons UMD shim module

Use explicit top level wrapper marker for top level elements
(cherry picked from commit 34c4474472)
2016-10-03 16:08:27 -07:00
Sebastian Markbåge
7ae3bbee25 Bundle DOM renderers into their individual UMD bundles (#7164)
* Cut out isomorphic dependencies from the renderers

These files reaches into isomorphic files.

The ReactElement functions are exposed on the React object anyway
so I can just use those instead.

I also found some files that are not shared that should be in
renderers shared.

* Found a few more shared dependencies

renderSubtreeIntoContainer is only used by the DOM renderer.
It's not an addon.

ReactClass isn't needed as a dependency since injection doesn't
happen anymore.

* Use a shim file to load addons' dependencies on DOM

By replacing this intermediate file we can do the lazy loading
without needing any lazy requires. This set up works with ES
modules.

We could also replace the globalShim thing with aliased files
instead for consistency.

* Bundle DOM renderers into their individual UMD bundles

Instead of exposing the entire DOM renderer on the react.js
package, I only expose CurrentOwner and ComponentTreeDevtool which
are currently the only two modules that share __state__ with the
renderers.

Then I package each renderer in its own package. That could allow
us to drop more server dependencies from the client package. It
will also allow us to ship fiber as a separate renderer.

Unminified DEV            after     before
react.js                  123kb     696kb
react-with-addons.js      227kb     774kb
react-dom.js              668kb     1kb
react-dom-server.js       638kb     1kb

Minified PROD             after     before
react.min.js               24kb     154kb
react-with-addons.min.js   37kb     166kb
react-dom.min.js          149kb     1kb
react-dom-server.min.js   144kb     1kb

The total size for react.min.js + react-dom.min.js is +19kb larger
because of the overlap between them right now. I'd like to see
what an optimizing compiler can do to this. Some of that is fbjs
stuff. There shouldn't need to be that much overlap so that's
something we can hunt. We should keep isomorphic absolutely
minimal so there's no reason for other React clones not to use it.
There will be less overlap with Fiber.

However, another strategy that we could do is package the
isomorphic package into each renderer bundle and conditionally
initialize it if it hasn't already been initialized. That way
you only pay an overlap tax when there are two renderers on the
page but not without it. It's also easier to just pull in one
package. The downside is the versioning stuff that the separate
npm package would solve. That applies to CDNs as well.

ReactWithAddons is a bit weird because it is packaged into the
isomorphic package but has a bunch of DOM dependencies. So we have
to load them lazily since the DOM package gets initialized after.

(cherry picked from commit 8ef00dbb7d)
2016-10-03 16:08:27 -07:00
B.Orlov
bada298857 Fix batchedUpdates return value (#7444)
(cherry picked from commit 7d57c1f0c1)
2016-10-03 16:08:27 -07:00
Sebastian Markbåge
5a540f778a Merge pull request #7248 from sebmarkbage/fibercleanup
[Fiber] Various minor tweaks and a few big ones
(cherry picked from commit a8c8191264)
2016-10-03 16:08:27 -07:00
Cheng Lou
bed4c0595c PropTypes: distinguish nullable from optional object field (#7291)
* PropTypes: distinguish nullable from optional object field

This gives a more precise message (no type semantics change) to the case of passing a field in an object, but whose value is `null`:

Before:

```js
propTypes: {
  foo: React.PropTypes.number.isRequired
}
```

Would scream "Required prop `foo` was not specified in `MyComp`".

Now it'll be "Required prop `foo` was specified in `MyComp`, but its value is `null`.".

Works as expected in nested objects.

This fixes the issue of a component transitively passing a `null`, specifying the correct field to the child but have the child tell it that it didn't provide the prop.

Optional field and nullable are two different things anyway.

* Add missing test case.

* Reword messages.

(cherry picked from commit 0292d34047)
2016-10-03 16:08:19 -07:00
Paul O’Shannessy
0c89348be4 Merge remote-tracking branch 'upstream/15-stable' into 15-dev 2016-10-03 15:55:53 -07:00
Eric Douglas
53d16f86fd Update babel link (#7837)
(cherry picked from commit e32196222b)
2016-10-03 15:54:27 -07:00
Ivan Zotov
ecd66274a7 Fix mistakes in the codebase overview (#7834)
(cherry picked from commit 16ac141f44)
2016-10-03 15:54:26 -07:00
Gil Chen-Zion
586f487ea9 Note that getInitialState is not used in ES6 classes in docs (#7748)
(cherry picked from commit a2bb55e3f4)
2016-10-03 15:54:26 -07:00
Ben Alpert
03e7900edb Update remarkable to 1.7.1 (#7851)
Fixes a subtle XSS hole.
(cherry picked from commit f88c1d38be)
2016-10-03 14:25:07 -07:00
ankitml
345329e079 Keyed Fragment of AddOns ported to ES6 2016-10-03 21:45:37 +01:00
Alex Zherdev
f5798f729d Add-Ons: Animation updated with ES6 examples 2016-10-03 21:30:33 +01:00
Rafael Angeline
dcd34ab6c1 Reusable Components ES6 Update 2016-10-03 21:02:43 +01:00
gillchristian
8a78b2497a Docs to ES6: Displaying data example. 2016-10-03 19:22:53 +01:00
Dan Abramov
58d66ad47f Add Codebase Overview (#7828)
* Add Codebase Overview

* Update codebase-overview.md

* Update codebase-overview.md
2016-09-29 11:34:35 +01:00
Kyle Mathews
f6448ff595 typos fix (#7822) 2016-09-28 20:45:07 +01:00
Christopher Chedeau
4421c71120 Our first 50,000 stars blogpost 2016-09-28 10:22:46 +01:00
Christoph Pojer
9a6ef44a06 Reduce confusion in testing documentation. (#7818)
* Reduce confusion in testing documentation.

Just wanted to add some clarity to this page and link to the react tutorial on Jest's website to give people more information. Also changed enzyme's definition from library to utility to help reduce the confusion. Hope this makes sense to everybody :)

See https://twitter.com/damusnet/status/780752042675597312

cc @lelandrichardson

* Update 10.4-test-utils.md

(cherry picked from commit 0990c93806)
2016-09-27 19:08:40 -07:00
Dan Abramov
ae5ebe3d92 Move How to Contribute to documentation and update it (#7817)
* Move How to Contribute to documentation and update it

* Consistent formatting
2016-09-27 23:22:32 +01:00
imjanghyuk
0c59b3c71f Update 07-forms.ko-KR.md (#7809)
fix spelling
(cherry picked from commit 6032491555)
2016-09-26 16:09:24 -07:00
jinmmd
6e58219117 Change [入门教程] from "tutorial.html" to "tutorial-zh-CN.html" (#7789)
(cherry picked from commit d9957ac075)
2016-09-26 16:09:24 -07:00
jinmmd
6259f15e33 Change [API参考] from "top-level-api.html" to "top-level-api-zh-CN.html" (#7790)
(cherry picked from commit 5331dfd1a5)
2016-09-26 16:09:24 -07:00
Dan Abramov
e48635bd59 Update broken JSFiddle in Why React blog post (#7783)
Fixes #7782
(cherry picked from commit 13692d59ad)
2016-09-26 16:09:24 -07:00
Paul O’Shannessy
cf592f29bc [docs] Update React Rally 2016 videos link (#7771)
(cherry picked from commit 2058d47e7b)
2016-09-19 14:27:04 -07:00
Ivan Zotov
00e9080314 Fix links and ids for tips in docs (#7766)
(cherry picked from commit 2ec2d8f7f7)
2016-09-19 14:27:04 -07:00
Ivan Zotov
17336bc8ee Russian translation for style props value px of tips (#7742)
* Russian translation for style props value px of tips

* Update 06-style-props-value-px.ru-RU.md

(cherry picked from commit 4dd554c9b7)
2016-09-19 14:27:04 -07:00
Ivan Zotov
1df0e8a012 Russian translation for max. numbers of jsx root nodes (#7738)
* Russian translation for max. numbers of jsx root nodes

* Update 05-maximum-number-of-jsx-root-nodes.ru-RU.md

(cherry picked from commit 8176f4970c)
2016-09-19 14:27:04 -07:00
Ivan Zotov
66a279df53 Russian translation for self-closing-tag of tips (#7729)
* Russian translation for self-closing-tag of tips

* Fix next link for inline styles tip

* Update 04-self-closing-tag.ru-RU.md

(cherry picked from commit 7d5c70d98c)
2016-09-19 14:27:04 -07:00
Ivan Zotov
5eb67ed4e2 Russian translation if-else in JSX of tips (#7726)
(cherry picked from commit 79367b09f7)
2016-09-19 14:27:03 -07:00
Ivan Zotov
fcd42c1e28 Russian translation for inline styles of tips (#7717)
(cherry picked from commit fcc37ccaa2)
2016-09-19 14:27:03 -07:00
Ivan Zotov
c99abadafb Fix Russian translation of introduction to be more technical (#7727)
(cherry picked from commit 7d76bdad69)
2016-09-19 14:27:03 -07:00
Amanvir Sangha
8753a838cf Update OWASP link in docs for dangerous innerHTML (#7710)
(cherry picked from commit 616e468987)
2016-09-19 14:27:03 -07:00
Ivan Zotov
749e809478 Add Russian translation for introduction of tips (#7690)
(cherry picked from commit 4dd44e77f8)
2016-09-19 14:27:03 -07:00
Michał Pierzchała
fb37b44e79 Proper font-family for docs input fields (#7706) (#7708)
(cherry picked from commit b87bcb96ac)
2016-09-19 14:27:03 -07:00
Ray Dai
8f8a26c091 Update 14-communicate-between-components.ko-KR.md (#7686)
Apply the same change made in #7680.
(cherry picked from commit 2fc7125d49)
2016-09-19 14:27:03 -07:00
Ray Dai
c2e9167e45 Update 14-communicate-between-components.md (#7680)
To demonstrate multiple arguments `bind(this, arg1, arg2, ...)`, also not to pass in for than what `handleClick` needed, namely props, or maybe even pass item itself, etc.
Going to change the kor file after review.
(cherry picked from commit 05cbc93401)
2016-09-19 14:27:02 -07:00
Gant Laborde
13ef94ad46 Adding the published ReactRally videos section (#7681)
ReactRally came and went, and it was splendid.
(cherry picked from commit 90a120c603)
2016-09-19 14:27:02 -07:00
Paul O’Shannessy
c2388bf09b Fix formatting of 15.3.2 changelog 2016-09-19 10:56:27 -07:00
Paul O’Shannessy
b52ea6bd8f Update website for 15.3.2 2016-09-19 10:45:02 -07:00
Paul O’Shannessy
bdf263625d 15.3.2 2016-09-19 10:35:00 -07:00
Paul O’Shannessy
8c7bbbfc21 Update Changelog & Readme for 15.3.2 2016-09-19 10:33:58 -07:00
Paul O’Shannessy
15631e02a2 Merge branch '15-dev' into 15-stable 2016-09-19 10:22:31 -07:00
Paul O’Shannessy
1907f72934 15.3.2-rc.1 2016-09-15 16:40:56 -07:00
Stephen John Sorensen
ba62748217 remove plain object warning (#7724)
(cherry picked from commit b2297ae6c3)
2016-09-15 16:32:45 -07:00
tokikuch
224ace32be BeforeInput is fired with a wrong text at a wrong time on IE (#7107)
(cherry picked from commit a64ca9b697)
2016-09-15 16:32:45 -07:00
Brandon Dail
3ef748abb3 Use compositeType in warning invariant for refs (#7658)
(cherry picked from commit 06ea71d3fd)
2016-09-15 16:32:45 -07:00
Paul O’Shannessy
3f8b8d754c Add more specific link to react-addons-shallow-compare readme (#7608)
(cherry picked from commit 2e38fcf355)
2016-09-15 16:32:45 -07:00
Paul O’Shannessy
7a18e4e00b Copy all SVG child nodes when using setting innerHTML in IE (#7618)
(cherry picked from commit c73d8633c3)
2016-09-15 16:32:45 -07:00
Mateusz Burzyński
60ed71459c Guarded ensureScrollValueMonitoring against some malicious script on the Internet overriding native document.createEvent (fixes #6887) (#7621)
(cherry picked from commit 51476de913)
2016-09-15 16:32:45 -07:00
Ben Alpert
7b39bbaa91 Improve error boundaries tests (#7569)
(cherry picked from commit 7d7defe30f)
2016-09-15 16:32:45 -07:00
Miller Medeiros
2927c4ce76 Add checkpoint/rollback to ReactNativeReconcileTransaction (#7619)
(cherry picked from commit 51f04fdbc1)
2016-09-15 16:32:45 -07:00
Kevin Lin
3e47b3002b Add 'as' keyword (#7543) (#7582)
* Add 'as' keyword (#7543)

* fix commenting to adhere to styling

* fix grammar in comment

(cherry picked from commit c85f46320e)
2016-09-15 16:32:45 -07:00
Marcin Mazurek
1bac6d567f Warn if input changes controlledness - also for null (#7544) (#7603)
(cherry picked from commit ba84b5b0a7)
2016-09-15 16:32:45 -07:00
TedPowers
92cfbf16c2 Changed to !document.documentMode (#7594)
(cherry picked from commit 8397ef58db)
2016-09-15 16:32:45 -07:00
Miller Medeiros
b445b26164 Support error boundaries on ReactTestRenderer (#7558)
(cherry picked from commit 38f74bcaf4)
2016-09-15 16:32:45 -07:00
Dan Abramov
832c503c92 Ensure lifecycle timers are stopped on errors (#7548)
* Ensure lifecycle timers are stopped on errors

Fixes #7349

* Address review feedback and add an extra test

(cherry picked from commit a229cdba7f)
2016-09-15 16:32:45 -07:00
Paul Kehrer
076d7fd63a Add playsInline as an allowed HTML property (#7519)
The WHATWG has unprefixed `-webkit-playsinline` as `playsinline` (see: https://github.com/whatwg/html/pull/1444) and iOS 10 intends to use it (https://webkit.org/blog/6784/new-video-policies-for-ios/).
(cherry picked from commit 7b11aa9450)
2016-09-15 16:32:45 -07:00
Lucas
3ed71070a3 Add missing KeyUp eventType (#7533)
Fixes #7222.
(cherry picked from commit 869cb05b76)
2016-09-15 16:32:45 -07:00
Greg Palmer
08dbefedc7 Avoid "Member not found" error in IE (#7411)
Explanation, discussion, and similar change as #7343

Addresses #7320
(cherry picked from commit a8741963dc)
2016-09-15 16:32:45 -07:00
Ben Alpert
4be377650e Improve validateDOMNesting message for whitespace (#7515)
For #5071.
(cherry picked from commit 6a65960641)
2016-09-15 16:32:45 -07:00
Paul O’Shannessy
8898803b4a Merge remote-tracking branch 'upstream/15-stable' into 15-dev 2016-09-15 16:31:58 -07:00
Kite
21f71d72f0 Fix the HTML for package management (#7656)
(cherry picked from commit ed8a753346)
2016-09-06 15:35:57 -07:00
却痕
d79061e0c6 docs:translate doc 11-advanced-performance to chinese (#7584)
(cherry picked from commit 4c365ea957)
2016-09-06 15:35:57 -07:00
Michael Jackson
d951c560e4 s/npmcdn/unpkg/g (#7609)
npmcdn.com is moving to unpkg.com. Same backend, one less letter in the
domain name. Boom.
(cherry picked from commit 9fd42264fe)
2016-09-06 15:35:57 -07:00
Duke Pham
6cf782b75c Add line breaks to examples on 10.1-animation docs per (#7606)
comments to issue #7317.
Updated JP doc examples to match other languages
Reformat to match JSX multi-line style #7550
(cherry picked from commit 3071f31d04)
2016-09-06 15:35:57 -07:00
Robert Kielty
dca0f7315c Adds minor additions clarifying questions I had reading intro tutorial (#7595)
(cherry picked from commit ee199381de)
2016-09-06 15:35:57 -07:00
Nik Nyby
0983d2dbcf docs: re-position comments to account for code sample width (#7602)
(cherry picked from commit 9511b4fe29)
2016-09-06 15:35:57 -07:00
Christophe Hurpeau
d90cbec236 doc: npm ls react is a better advice (#7513)
Refs Must Have Owner Warning
`npm ls react` is a better advice than `npm ls | grep react`
(cherry picked from commit 517a0dc051)
2016-09-06 15:35:57 -07:00
NestorTejero
6e20d410bb add explicit link to http://bower.io/ (#7546)
(cherry picked from commit 32e60fecdc)
2016-09-06 15:35:56 -07:00
Dan Abramov
b4f6460bff Link to Create React App (#7654)
* Link to Create React App

* Reword
2016-09-03 18:14:00 +01:00
Paul O’Shannessy
199056cf1b Update website for 15.3.1 2016-08-19 11:46:11 -07:00
1111 changed files with 70572 additions and 93483 deletions

View File

@@ -1,4 +1,5 @@
# We can probably lint these later but not important at this point
addons/**/node_modules/
src/renderers/art
src/shared/vendor
# But not in docs/_js/examples/*
@@ -10,6 +11,7 @@ docs/vendor/bundle/
# This should be more like examples/**/thirdparty/** but
# we should fix https://github.com/facebook/esprima/pull/85 first
examples/
fixtures/
# Ignore built files.
build/
coverage/

View File

@@ -3,32 +3,27 @@ const WARNING = 1;
const ERROR = 2;
module.exports = {
parser: 'babel-eslint',
extends: './node_modules/fbjs-scripts/eslint/.eslintrc.js',
extends: 'fbjs',
plugins: [
'react',
'react-internal',
],
ecmaFeatures: {
modules: false
},
// We're stricter than the default config, mostly. We'll override a few rules
// and then enable some React specific ones.
rules: {
'accessor-pairs': OFF,
'brace-style': [ERROR, '1tbs'],
'comma-dangle': [ERROR, 'always-multiline'],
'consistent-return': ERROR,
'consistent-return': OFF,
'dot-location': [ERROR, 'property'],
'dot-notation': ERROR,
'eol-last': ERROR,
'eqeqeq': [ERROR, 'allow-null'],
'indent': [ERROR, 2, {SwitchCase: 1}],
'indent': OFF, // We use Prettier now
'jsx-quotes': [ERROR, 'prefer-double'],
'keyword-spacing': [ERROR, {after: true, before: true}],
'no-bitwise': OFF,
'no-inner-declarations': [ERROR, 'functions'],
'no-multi-spaces': ERROR,
@@ -36,35 +31,22 @@ module.exports = {
'no-shadow': ERROR,
'no-unused-expressions': ERROR,
'no-unused-vars': [ERROR, {args: 'none'}],
'quotes': [ERROR, 'single', 'avoid-escape'],
'space-after-keywords': ERROR,
'quotes': [ERROR, 'single', {avoidEscape: true, allowTemplateLiterals: true }],
'space-before-blocks': ERROR,
'space-before-function-paren': [ERROR, {anonymous: 'never', named: 'never'}],
'space-before-keywords': ERROR,
'strict': [ERROR, 'global'],
// React & JSX
// Our transforms set this automatically
'react/display-name': OFF,
'react/jsx-boolean-value': [ERROR, 'always'],
'react/jsx-no-undef': ERROR,
// We don't care to do this
'react/jsx-sort-prop-types': OFF,
'react/jsx-sort-props': OFF,
'react/jsx-uses-react': ERROR,
'react/jsx-uses-vars': ERROR,
// It's easier to test some things this way
'react/no-did-mount-set-state': OFF,
'react/no-did-update-set-state': OFF,
// We define multiple components in test files
'react/no-multi-comp': OFF,
'react/no-unknown-property': OFF,
'react/no-is-mounted': OFF,
// This isn't useful in our test code
'react/prop-types': OFF,
'react/react-in-jsx-scope': ERROR,
'react/self-closing-comp': ERROR,
// We don't care to do this
'react/sort-comp': OFF,
'react/wrap-multilines': [ERROR, {declaration: false, assignment: false}],
// CUSTOM RULES

View File

@@ -1,18 +1,23 @@
[ignore]
.*/examples/.*
.*/build/.*
.*/node_modules/y18n/.*
.*/__mocks__/.*
.*/__tests__/.*
<PROJECT_ROOT>/examples/.*
<PROJECT_ROOT>/fixtures/.*
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/node_modules/chrome-devtools-frontend/.*
<PROJECT_ROOT>/.*/node_modules/chrome-devtools-frontend/.*
<PROJECT_ROOT>/.*/node_modules/y18n/.*
<PROJECT_ROOT>/.*/__mocks__/.*
<PROJECT_ROOT>/.*/__tests__/.*
<PROJECT_ROOT>/addons/.*
# Ignore Docs
.*/docs/.*
<PROJECT_ROOT>/docs/.*
<PROJECT_ROOT>/.*/docs/.*
[include]
[libs]
./node_modules/fbjs/flow/lib
./node_modules/fbjs/flow/lib/dev.js
./flow
[options]
@@ -21,17 +26,18 @@ module.system=haste
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
experimental.strict_type_args=true
munge_underscores=false
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_type=$FlowExpectedError
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*\\)?)\\)? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[version]
^0.27.0
^0.37.0

11
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,11 @@
**Before submitting a pull request,** please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/react) and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes (`npm test`).
5. Make sure your code lints (`npm run lint`).
6. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`).
7. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`).
8. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes.
9. If you haven't already, complete the CLA.

8
.gitignore vendored
View File

@@ -15,9 +15,15 @@ docs/code
docs/_site
docs/.sass-cache
docs/js/*
docs/downloads
docs/downloads/*.zip
docs/vendor/bundle
<<<<<<< HEAD
examples/shared/*.js
examples/**/bundle.js
=======
fixtures/dom/public/react-dom.js
fixtures/dom/public/react.js
>>>>>>> 4a37718... Remove examples/ folder (#9323)
test/the-files-to-test.generated.js
*.log*
chrome-user-data

View File

@@ -28,8 +28,8 @@ script:
GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/../react-gh-pages
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc
git config --global user.name "Travis CI"
git config --global user.email "travis@reactjs.org"
git config --global user.name "$GITHUB_USER_NAME"
git config --global user.email "$GITHUB_USER_EMAIL"
git clone --branch gh-pages --depth=50 \
https://reactjs-bot@github.com/facebook/react.git \
@@ -39,7 +39,7 @@ script:
bundle exec rake release
cd $GH_PAGES_DIR
git status
if ! git diff-index --quiet HEAD --; then
if test -n "$(git status --porcelain)"; then
git add -A .
git commit -m "Rebuild website"
git push origin gh-pages
@@ -71,20 +71,40 @@ script:
fi
elif [ "$TEST_TYPE" = test ]; then
set -e
# Disabling coverage because it's broken:
# https://travis-ci.org/facebook/react/jobs/128163922
if false; then
./node_modules/.bin/grunt jest:coverage
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
else
./node_modules/.bin/grunt jest:normal
fi
./node_modules/.bin/grunt jest:coverage
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
echo 'Testing in server-render (HTML generation) mode...'
printf '\nmodule.exports.useCreateElement = false;\n' \
>> src/renderers/dom/shared/ReactDOMFeatureFlags.js
./node_modules/.bin/grunt jest:normal
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
echo 'Testing in fiber mode...'
printf '\nmodule.exports.useFiber = true;\n' \
>> src/renderers/dom/shared/ReactDOMFeatureFlags.js
FIBER_TESTS=`\
NODE_ENV=test node node_modules/jest/bin/jest --json | \
node -e "\
var data = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8')); \
console.log(data.numPassedTests + '/' + data.numTotalTests)\
"\
`
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
node scripts/facts-tracker/index.js \
"fiber-tests" "$FIBER_TESTS"
./node_modules/.bin/gulp react:extract-errors
elif [ "$TEST_TYPE" = flow ]; then
set -e
./node_modules/.bin/grunt flow
ALL_FILES=`find src -name '*.js' | grep -v umd/ | grep -v __tests__ | grep -v __mocks__`
COUNT_ALL_FILES=`echo "$ALL_FILES" | wc -l`
COUNT_WITH_FLOW=`grep '@flow' $ALL_FILES | perl -pe 's/:.+//' | wc -l`
node scripts/facts-tracker/index.js \
"flow-files" "$COUNT_WITH_FLOW/$COUNT_ALL_FILES"
else
./node_modules/.bin/grunt $TEST_TYPE
fi

View File

@@ -1,3 +1,189 @@
## 15.6.2 (September 25, 2017)
### All Packages
* Switch from BSD + Patents to MIT license
### React DOM
* Fix a bug where modifying document.documentMode would trigger IE detection in other browsers, breaking change events ([@aweary](https://github.com/aweary) in [#10032](https://github.com/facebook/react/pull/10032)
* CSS Columns are treated as unitless numbers ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/10115)
* Fix bug in QtWebKit when wrapping synthetic events in proxies ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011)
* Prevent event handlers from receiving extra argument (dev only) ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363)
* Fix cases where onChange would not fire with defaultChecked on radio inputs ([@jquense](https://github.com/jquense) in [#10156](https://github.com/facebook/react/pull/10156))
* Add support for controlList attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
* Fix a bug where creating an element with a ref in a constructor did not throw an error in dev mode ([@iansu](https://github.com/iansu) in [#10025](https://github.com/facebook/react/pull/10025))
## 15.6.1 (June 14, 2017)
### React DOM
* Fix a crash on iOS Safari. ([@jquense](https://github.com/jquense) in [#9960](https://github.com/facebook/react/pull/9960))
* Don't add `px` to custom CSS property values. ([@TrySound](https://github.com/TrySound) in [#9966](https://github.com/facebook/react/pull/9966))
## 15.6.0 (June 13, 2017)
### React
* Downgrade deprecation warnings to use `console.warn` instead of `console.error`. ([@flarnie](https://github.com/flarnie) in [#9753](https://github.com/facebook/react/pull/9753))
* Add a deprecation warning for `React.createClass`. Points users to `create-react-class` instead. ([@flarnie](https://github.com/flarnie) in [#9771](https://github.com/facebook/react/pull/9771))
* Add deprecation warnings and separate module for `React.DOM` factory helpers. ([@nhunzaker](https://github.com/nhunzaker) in [#8356](https://github.com/facebook/react/pull/8356))
* Warn for deprecation of `React.createMixin` helper, which was never used. ([@aweary](https://github.com/aweary) in [#8853](https://github.com/facebook/react/pull/8853))
### React DOM
* Add support for CSS variables in `style` attribute. ([@aweary](https://github.com/aweary) in [#9302](https://github.com/facebook/react/pull/9302))
* Add support for CSS Grid style properties. ([@ericsakmar](https://github.com/ericsakmar) in [#9185](https://github.com/facebook/react/pull/9185))
* Fix bug where inputs mutated value on type conversion. ([@nhunzaker](https://github.com/mhunzaker) in [#9806](https://github.com/facebook/react/pull/9806))
* Fix issues with `onChange` not firing properly for some inputs. ([@jquense](https://github.com/jquense) in [#8575](https://github.com/facebook/react/pull/8575))
* Fix bug where controlled number input mistakenly allowed period. ([@nhunzaker](https://github.com/nhunzaker) in [#9584](https://github.com/facebook/react/pull/9584))
* Fix bug where performance entries were being cleared. ([@chrisui](https://github.com/chrisui) in [#9451](https://github.com/facebook/react/pull/9451))
### React Addons
* Fix AMD support for addons depending on `react`. ([@flarnie](https://github.com/flarnie) in [#9919](https://github.com/facebook/react/issues/9919))
* Fix `isMounted()` to return `true` in `componentWillUnmount`. ([@mridgway](https://github.com/mridgway) in [#9638](https://github.com/facebook/react/issues/9638))
* Fix `react-addons-update` to not depend on native `Object.assign`. ([@gaearon](https://github.com/gaearon) in [#9937](https://github.com/facebook/react/pull/9937))
* Remove broken Google Closure Compiler annotation from `create-react-class`. ([@gaearon](https://github.com/gaearon) in [#9933](https://github.com/facebook/react/pull/9933))
* Remove unnecessary dependency from `react-linked-input`. ([@gaearon](https://github.com/gaearon) in [#9766](https://github.com/facebook/react/pull/9766))
* Point `react-addons-(css-)transition-group` to the new package. ([@gaearon](https://github.com/gaearon) in [#9937](https://github.com/facebook/react/pull/9937))
## 15.5.4 (April 11, 2017)
### React Addons
* **Critical Bugfix:** Update the version of `prop-types` to fix critical bug. ([@gaearon](https://github.com/gaearon) in [545c87f](https://github.com/facebook/react/commit/545c87fdc348f82eb0c3830bef715ed180785390))
* Fix `react-addons-create-fragment` package to include `loose-envify` transform for Browserify users. ([@mridgway](https://github.com/mridgway) in [#9642](https://github.com/facebook/react/pull/9642))
### React Test Renderer
* Fix compatibility with Enzyme by exposing `batchedUpdates` on shallow renderer. ([@gaearon](https://github.com/gaearon) in [9382](https://github.com/facebook/react/commit/69933e25c37cf5453a9ef132177241203ee8d2fd))
## 15.5.3 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React Addons
* Fix `react-addons-create-fragment` package to export correct thing. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
* Fix `create-react-class` package to include `loose-envify` transform for Browserify users. ([@mridgway](https://github.com/mridgway) in [#9642](https://github.com/facebook/react/pull/9642))
## 15.5.2 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React Addons
* Fix the production single-file builds to not include the development code. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
* Apply better minification to production single-file builds. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
* Add missing and remove unnecessary dependencies to packages. ([@gaearon](https://github.com/gaearon) in [#9385](https://github.com/facebook/react/pull/9383))
## 15.5.1 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React
* Fix erroneous PropTypes access warning. ([@acdlite](https://github.com/acdlite) in ([ec97ebb](https://github.com/facebook/react/commit/ec97ebbe7f15b58ae2f1323df39d06f119873344))
## 15.5.0 (April 7, 2017)
**Note: this release has a critical issue and was deprecated. Please update to 15.5.4 or higher.**
### React
* <s>Added a deprecation warning for `React.createClass`. Points users to create-react-class instead. ([@acdlite](https://github.com/acdlite) in [#d9a4fa4](https://github.com/facebook/react/commit/d9a4fa4f51c6da895e1655f32255cf72c0fe620e))</s>
* Added a deprecation warning for `React.PropTypes`. Points users to prop-types instead. ([@acdlite](https://github.com/acdlite) in [#043845c](https://github.com/facebook/react/commit/043845ce75ea0812286bbbd9d34994bb7e01eb28))
* Fixed an issue when using `ReactDOM` together with `ReactDOMServer`. ([@wacii](https://github.com/wacii) in [#9005](https://github.com/facebook/react/pull/9005))
* Fixed issue with Closure Compiler. ([@anmonteiro](https://github.com/anmonteiro) in [#8895](https://github.com/facebook/react/pull/8895))
* Another fix for Closure Compiler. ([@Shastel](https://github.com/Shastel) in [#8882](https://github.com/facebook/react/pull/8882))
* Added component stack info to invalid element type warning. ([@n3tr](https://github.com/n3tr) in [#8495](https://github.com/facebook/react/pull/8495))
### React DOM
* Fixed Chrome bug when backspacing in number inputs. ([@nhunzaker](https://github.com/nhunzaker) in [#7359](https://github.com/facebook/react/pull/7359))
* Added `react-dom/test-utils`, which exports the React Test Utils. ([@bvaughn](https://github.com/bvaughn))
### React Test Renderer
* Fixed bug where `componentWillUnmount` was not called for children. ([@gre](https://github.com/gre) in [#8512](https://github.com/facebook/react/pull/8512))
* Added `react-test-renderer/shallow`, which exports the shallow renderer. ([@bvaughn](https://github.com/bvaughn))
### React Addons
* Last release for addons; they will no longer be actively maintained.
* Removed `peerDependencies` so that addons continue to work indefinitely. ([@acdlite](https://github.com/acdlite) and [@bvaughn](https://github.com/bvaughn) in [8a06cd7](https://github.com/facebook/react/commit/8a06cd7a786822fce229197cac8125a551e8abfa) and [67a8db3](https://github.com/facebook/react/commit/67a8db3650d724a51e70be130e9008806402678a))
* Updated to remove references to `React.createClass` and `React.PropTypes` ([@acdlite](https://github.com/acdlite) in [12a96b9](https://github.com/facebook/react/commit/12a96b94823d6b6de6b1ac13bd576864abd50175))
* `react-addons-test-utils` is deprecated. Use `react-dom/test-utils` and `react-test-renderer/shallow` instead. ([@bvaughn](https://github.com/bvaughn))
## 15.4.2 (January 6, 2017)
### React
* Fixed build issues with the Brunch bundler. ([@gaearon](https://github.com/gaearon) in [#8686](https://github.com/facebook/react/pull/8686))
* Improved error messages for invalid element types. ([@spicyj](https://github.com/spicyj) in [#8612](https://github.com/facebook/react/pull/8612))
* Removed a warning about `getInitialState` when `this.state` is set. ([@bvaughn](https://github.com/bvaughn) in [#8594](https://github.com/facebook/react/pull/8594))
* Removed some dead code. ([@diegomura](https://github.com/diegomura) in [#8050](https://github.com/facebook/react/pull/8050), [@dfrownfelter](https://github.com/dfrownfelter) in [#8597](https://github.com/facebook/react/pull/8597))
### React DOM
* Fixed a decimal point issue on uncontrolled number inputs. ([@nhunzaker](https://github.com/nhunzaker) in [#7750](https://github.com/facebook/react/pull/7750))
* Fixed rendering of textarea placeholder in IE11. ([@aweary](https://github.com/aweary) in [#8020](https://github.com/facebook/react/pull/8020))
* Worked around a script engine bug in IE9. ([@eoin](https://github.com/eoin) in [#8018](https://github.com/facebook/react/pull/8018))
### React Addons
* Fixed build issues in RequireJS and SystemJS environments. ([@gaearon](https://github.com/gaearon) in [#8686](https://github.com/facebook/react/pull/8686))
* Added missing package dependencies. ([@kweiberth](https://github.com/kweiberth) in [#8467](https://github.com/facebook/react/pull/8467))
## 15.4.1 (November 22, 2016)
### React
* Restructure variable assignment to work around a Rollup bug ([@gaearon](https://github.com/gaearon) in [#8384](https://github.com/facebook/react/pull/8384))
### React DOM
* Fixed event handling on disabled button elements ([@spicyj](https://github.com/spicyj) in [#8387](https://github.com/facebook/react/pull/8387))
* Fixed compatibility of browser build with AMD environments ([@zpao](https://github.com/zpao) in [#8374](https://github.com/facebook/react/pull/8374))
## 15.4.0 (November 16, 2016)
### React
* React package and browser build no longer "secretly" includes React DOM. ([@sebmarkbage](https://github.com/sebmarkbage) in [#7164](https://github.com/facebook/react/pull/7164) and [#7168](https://github.com/facebook/react/pull/7168))
* Required PropTypes now fail with specific messages for null and undefined. ([@chenglou](https://github.com/chenglou) in [#7291](https://github.com/facebook/react/pull/7291))
* Improved development performance by freezing children instead of copying. ([@keyanzhang](https://github.com/keyanzhang) in [#7455](https://github.com/facebook/react/pull/7455))
### React DOM
* Fixed occasional test failures when React DOM is used together with shallow renderer. ([@goatslacker](https://github.com/goatslacker) in [#8097](https://github.com/facebook/react/pull/8097))
* Added a warning for invalid `aria-` attributes. ([@jessebeach](https://github.com/jessebeach) in [#7744](https://github.com/facebook/react/pull/7744))
* Added a warning for using `autofocus` rather than `autoFocus`. ([@hkal](https://github.com/hkal) in [#7694](https://github.com/facebook/react/pull/7694))
* Removed an unnecessary warning about polyfilling `String.prototype.split`. ([@nhunzaker](https://github.com/nhunzaker) in [#7629](https://github.com/facebook/react/pull/7629))
* Clarified the warning about not calling PropTypes manually. ([@jedwards1211](https://github.com/jedwards1211) in [#7777](https://github.com/facebook/react/pull/7777))
* The unstable `batchedUpdates` API now passes the wrapped function's return value through. ([@bgnorlov](https://github.com/bgnorlov) in [#7444](https://github.com/facebook/react/pull/7444))
* Fixed a bug with updating text in IE 8. ([@mnpenner](https://github.com/mnpenner) in [#7832](https://github.com/facebook/react/pull/7832))
### React Perf
* When ReactPerf is started, you can now view the relative time spent in components as a chart in Chrome Timeline. ([@gaearon](https://github.com/gaearon) in [#7549](https://github.com/facebook/react/pull/7549))
### React Test Utils
* If you call `Simulate.click()` on a `<input disabled onClick={foo} />` then `foo` will get called whereas it didn't before. ([@nhunzaker](https://github.com/nhunzaker) in [#7642](https://github.com/facebook/react/pull/7642))
### React Test Renderer
* Due to packaging changes, it no longer crashes when imported together with React DOM in the same file. ([@sebmarkbage](https://github.com/sebmarkbage) in [#7164](https://github.com/facebook/react/pull/7164) and [#7168](https://github.com/facebook/react/pull/7168))
* `ReactTestRenderer.create()` now accepts `{createNodeMock: element => mock}` as an optional argument so you can mock refs with snapshot testing. ([@Aweary](https://github.com/Aweary) in [#7649](https://github.com/facebook/react/pull/7649), [#8261](https://github.com/facebook/react/pull/8261))
## 15.3.2 (September 19, 2016)
### React
- Remove plain object warning from React.createElement & React.cloneElement. ([@spudly](https://github.com/spudly) in [#7724](https://github.com/facebook/react/pull/7724))
### React DOM
- Add `playsInline` to supported HTML attributes. ([@reaperhulk](https://github.com/reaperhulk) in [#7519](https://github.com/facebook/react/pull/7519))
- Add `as` to supported HTML attributes. ([@kevinslin](https://github.com/kevinslin) in [#7582](https://github.com/facebook/react/pull/7582))
- Improve DOM nesting validation warning about whitespace. ([@spicyj](https://github.com/spicyj) in [#7515](https://github.com/facebook/react/pull/7515))
- Avoid "Member not found" exception in IE10 when calling `preventDefault()` in Synthetic Events. ([@g-palmer](https://github.com/g-palmer) in [#7411](https://github.com/facebook/react/pull/7411))
- Fix memory leak in `onSelect` implementation. ([@AgtLucas](https://github.com/AgtLucas) in [#7533](https://github.com/facebook/react/pull/7533))
- Improve robustness of `document.documentMode` checks to handle Google Tag Manager. ([@SchleyB](https://github.com/SchleyB) in [#7594](https://github.com/facebook/react/pull/7594))
- Add more cases to controlled inputs warning. ([@marcin-mazurek](https://github.com/marcin-mazurek) in [#7544](https://github.com/facebook/react/pull/7544))
- Handle case of popup blockers overriding `document.createEvent`. ([@Andarist](https://github.com/Andarist) in [#7621](https://github.com/facebook/react/pull/7621))
- Fix issue with `dangerouslySetInnerHTML` and SVG in Internet Explorer. ([@zpao](https://github.com/zpao) in [#7618](https://github.com/facebook/react/pull/7618))
- Improve handling of Japanese IME on Internet Explorer. ([@msmania](https://github.com/msmania) in [#7107](https://github.com/facebook/react/pull/7107))
### React Test Renderer
- Support error boundaries. ([@millermedeiros](https://github.com/millermedeiros) in [#7558](https://github.com/facebook/react/pull/7558), [#7569](https://github.com/facebook/react/pull/7569), [#7619](https://github.com/facebook/react/pull/7619))
- Skip null ref warning. ([@Aweary](https://github.com/Aweary) in [#7658](https://github.com/facebook/react/pull/7658))
### React Perf Add-on
- Ensure lifecycle timers are stopped on errors. ([@gaearon](https://github.com/gaearon) in [#7548](https://github.com/facebook/react/pull/7548))
## 15.3.1 (August 19, 2016)
### React
@@ -187,7 +373,7 @@
- **Initial render now uses `document.createElement` instead of generating HTML.** Previously we would generate a large string of HTML and then set `node.innerHTML`. At the time, this was decided to be faster than using `document.createElement` for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using `createElement` we can make other parts of React faster. ([@spicyj](https://github.com/spicyj) in [#5205](https://github.com/facebook/react/pull/5205))
- **`data-reactid` is no longer on every node.** As a result of using `document.createElement`, we can prime the node cache as we create DOM nodes, allowing us to skip a potential lookup (which used the `data-reactid` attribute). Root nodes will have a `data-reactroot` attribute and server generated markup will still contain `data-reactid`. ([@spicyj](https://github.com/spicyj) in [#5205](https://github.com/facebook/react/pull/5205))
- **No more extra `<span>`s.** ReactDOM will now render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. If you were targeting these `<span>`s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components. ([@mwiencek](https://github.com/mwiencek) in [#5753](https://github.com/facebook/react/pull/5753))
- **Rendering `null` now uses comment nodes.** Previously `null` would render to `<noscript>` elements. We now use comment nodes. This may cause issues if making use of `:nth-child` CSS selectors. While we consider this rendering behavior an implementation detail of React, it's worth noting the potential problem. ()[@spicyj](https://github.com/spicyj) in [#5451](https://github.com/facebook/react/pull/5451))
- **Rendering `null` now uses comment nodes.** Previously `null` would render to `<noscript>` elements. We now use comment nodes. This may cause issues if making use of `:nth-child` CSS selectors. While we consider this rendering behavior an implementation detail of React, it's worth noting the potential problem. ([@spicyj](https://github.com/spicyj) in [#5451](https://github.com/facebook/react/pull/5451))
- **Functional components can now return `null`.** We added support for [defining stateless components as functions](/react/blog/2015/09/10/react-v0.14-rc1.html#stateless-function-components) in React 0.14. However, React 0.14 still allowed you to define a class component without extending `React.Component` or using `React.createClass()`, so [we couldnt reliably tell if your component is a function or a class](https://github.com/facebook/react/issues/5355), and did not allow returning `null` from it. This issue is solved in React 15, and you can now return `null` from any component, whether it is a class or a function. ([@jimfb](https://github.com/jimfb) in [#5884](https://github.com/facebook/react/pull/5884))
- **Improved SVG support.** All SVG tags are now fully supported. (Uncommon SVG tags are not present on the `React.DOM` element helper, but JSX and `React.createElement` work on all tag names.) All SVG attributes that are implemented by the browsers should be supported too. If you find any attributes that we have missed, please [let us know in this issue](https://github.com/facebook/react/issues/1657). ([@zpao](https://github.com/zpao) in [#6243](https://github.com/facebook/react/pull/6243))
@@ -253,7 +439,7 @@ Each of these changes will continue to work as before with a new warning until t
- `Object.is` is used in a number of places to compare values, which leads to fewer false positives, especially involving `NaN`. In particular, this affects the `shallowCompare` add-on. ([@chicoxyzzy](https://github.com/chicoxyzzy) in [#6132](https://github.com/facebook/react/pull/6132))
- Add-Ons: ReactPerf no longer instruments adding or removing an event listener because they dont really touch the DOM due to event delegation. ([@antoaravinth](https://github.com/antoaravinth) in [#5209](https://github.com/facebook/react/pull/5209))
### Other improvements
### Other improvements
- React now uses `loose-envify` instead of `envify` so it installs fewer transitive dependencies. ([@qerub](https://github.com/qerub) in [#6303](https://github.com/facebook/react/pull/6303))
- Shallow renderer now exposes `getMountedInstance()`. ([@glenjamin](https://github.com/glenjamin) in [#4918](https://github.com/facebook/react/pull/4918))
@@ -363,7 +549,7 @@ Each of these changes will continue to work as before with a new warning until t
- `React.initializeTouchEvents` is no longer necessary and has been removed completely. Touch events now work automatically.
- Add-Ons: Due to the DOM node refs change mentioned above, `TestUtils.findAllInRenderedTree` and related helpers are no longer able to take a DOM component, only a custom component.
- The `props` object is now frozen, so mutating props after creating a component element is no longer supported. In most cases, [`React.cloneElement`](https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement) should be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.
- The `props` object is now frozen, so mutating props after creating a component element is no longer supported. In most cases, [`React.cloneElement`](https://facebook.github.io/react/docs/react-api.html#cloneelement) should be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.
- Plain objects are no longer supported as React children; arrays should be used instead. You can use the [`createFragment`](https://facebook.github.io/react/docs/create-fragment.html) helper to migrate, which now returns an array.
- Add-Ons: `classSet` has been removed. Use [classnames](https://github.com/JedWatson/classnames) instead.
- Web components (custom elements) now use native property names. Eg: `class` instead of `className`.
@@ -374,7 +560,7 @@ Each of these changes will continue to work as before with a new warning until t
- `setProps` and `replaceProps` are now deprecated. Instead, call ReactDOM.render again at the top level with the new props.
- ES6 component classes must now extend `React.Component` in order to enable stateless function components. The [ES3 module pattern](https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#other-languages) will continue to work.
- Reusing and mutating a `style` object between renders has been deprecated. This mirrors our change to freeze the `props` object.
- Add-Ons: `cloneWithProps` is now deprecated. Use [`React.cloneElement`](https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement) instead (unlike `cloneWithProps`, `cloneElement` does not merge `className` or `style` automatically; you can merge them manually if needed).
- Add-Ons: `cloneWithProps` is now deprecated. Use [`React.cloneElement`](https://facebook.github.io/react/docs/react-api.html#cloneelement) instead (unlike `cloneWithProps`, `cloneElement` does not merge `className` or `style` automatically; you can merge them manually if needed).
- Add-Ons: To improve reliability, `CSSTransitionGroup` will no longer listen to transition events. Instead, you should specify transition durations manually using props such as `transitionEnterTimeout={500}`.
### Notable enhancements

View File

@@ -1,102 +1,5 @@
# Contributing to React
React is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on [facebook.com](https://www.facebook.com). We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and answers some questions that you may have.
Want to contribute to React? There are a few things you need to know.
## [Code of Conduct](https://code.facebook.com/codeofconduct)
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
## Our Development Process
Some of the core team will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
### `master` is unsafe
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be.
### Test Suite
Use `grunt test` to run the full test suite with PhantomJS.
This command is just a facade to [Jest](https://facebook.github.io/jest/). You may optionally run `npm install -g jest-cli` and use Jest commands directly to have more control over how tests are executed.
For example, `jest --watch` lets you automatically run the test suite on every file change.
You can also run a subset of tests by passing a prefix to `jest`. For instance, `jest ReactDOMSVG` will only run tests in the files that start with `ReactDOMSVG`, such as `ReactDOMSVG-test.js`.
When you know which tests you want to run, you can achieve a fast feedback loop by using these two features together. For example, `jest ReactDOMSVG --watch` will re-run only the matching tests on every change.
Just make sure to run the whole test suite before submitting a pull request!
### Pull Requests
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
You may also be interested in watching [this short video](https://www.youtube.com/watch?v=wUpPsEcGsg8) (26 mins) which gives an introduction on how to contribute to the React JS project.
The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
*Before* submitting a pull request, please make sure the following is done…
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes (`grunt test`).
5. Make sure your code lints (`grunt lint`) - we've done our best to make sure these rules match our internal linting guidelines.
6. If you haven't already, complete the CLA.
### Contributor License Agreement (CLA)
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username.
[Complete your CLA here.](https://code.facebook.com/cla)
## Bugs
### Where to Find Known Issues
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist.
### Reporting New Issues
The best way to get your bug fixed is to provide a reduced test case. jsFiddle, jsBin, and other sites provide a way to give live examples. Those are especially helpful though may not work for `JSX`-based code.
### Security Bugs
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
## How to Get in Touch
* IRC - [#reactjs on freenode](https://webchat.freenode.net/?channels=reactjs)
* Discussion forum - [discuss.reactjs.org](https://discuss.reactjs.org/)
## Meeting Notes
React team meets once a week to discuss the development of React, future plans, and priorities.
You can find the meeting notes in a [dedicated repository](https://github.com/reactjs/core-notes/).
## Style Guide
Our linter will catch most styling issues that may exist in your code.
You can check the status of your code styling by simply running: `grunt lint`
However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb's Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction.
### Code Conventions
* Use semicolons `;`
* Commas last `,`
* 2 spaces for indentation (no tabs)
* Prefer `'` over `"`
* `'use strict';`
* 80 character line length
* Write "attractive" code
* Do not use the optional parameters of `setTimeout` and `setInterval`
### Documentation
* Do not wrap lines at 80 characters
## License
By contributing to React, you agree that your contributions will be licensed under its BSD license.
We wrote a **[contribution guide](https://facebook.github.io/react/contributing/how-to-contribute.html)** to help you get started.

View File

@@ -23,8 +23,6 @@ module.exports = function(grunt) {
'compare_size': require('./grunt/config/compare_size'),
});
grunt.config.set('compress', require('./grunt/config/compress'));
function spawnGulp(args, opts, done) {
grunt.util.spawn({
@@ -82,14 +80,6 @@ module.exports = function(grunt) {
grunt.registerTask('npm-react-dom:release', npmReactDOMTasks.buildRelease);
grunt.registerTask('npm-react-dom:pack', npmReactDOMTasks.packRelease);
var npmReactNativeTasks = require('./grunt/tasks/npm-react-native');
grunt.registerTask('npm-react-native:release', npmReactNativeTasks.buildRelease);
grunt.registerTask('npm-react-native:pack', npmReactNativeTasks.packRelease);
var npmReactAddonsTasks = require('./grunt/tasks/npm-react-addons');
grunt.registerTask('npm-react-addons:release', npmReactAddonsTasks.buildReleases);
grunt.registerTask('npm-react-addons:pack', npmReactAddonsTasks.packReleases);
var npmReactTestRendererTasks = require('./grunt/tasks/npm-react-test');
grunt.registerTask('npm-react-test:release', npmReactTestRendererTasks.buildRelease);
grunt.registerTask('npm-react-test:pack', npmReactTestRendererTasks.packRelease);
@@ -117,12 +107,41 @@ module.exports = function(grunt) {
'build-modules',
'browserify:addonsMin',
]);
grunt.registerTask('build:dom', [
'build-modules',
'version-check',
'browserify:dom',
]);
grunt.registerTask('build:dom-min', [
'build-modules',
'version-check',
'browserify:domMin',
]);
grunt.registerTask('build:dom-server', [
'build-modules',
'version-check',
'browserify:domServer',
]);
grunt.registerTask('build:dom-server-min', [
'build-modules',
'version-check',
'browserify:domServerMin',
]);
grunt.registerTask('build:dom-fiber', [
'build-modules',
'version-check',
'browserify:domFiber',
]);
grunt.registerTask('build:dom-fiber-min', [
'build-modules',
'version-check',
'browserify:domFiberMin',
]);
grunt.registerTask('build:npm-react', [
'version-check',
'build-modules',
'npm-react:release',
]);
grunt.registerTask('build:react-dom', require('./grunt/tasks/react-dom'));
var jestTasks = require('./grunt/tasks/jest');
grunt.registerTask('jest:normal', jestTasks.normal);
@@ -141,15 +160,16 @@ module.exports = function(grunt) {
'browserify:addons',
'browserify:min',
'browserify:addonsMin',
'build:react-dom',
'browserify:dom',
'browserify:domMin',
'browserify:domServer',
'browserify:domServerMin',
'browserify:domFiber',
'browserify:domFiberMin',
'npm-react:release',
'npm-react:pack',
'npm-react-dom:release',
'npm-react-dom:pack',
'npm-react-native:release',
'npm-react-native:pack',
'npm-react-addons:release',
'npm-react-addons:pack',
'npm-react-test:release',
'npm-react-test:pack',
'compare_size',
@@ -161,15 +181,12 @@ module.exports = function(grunt) {
grunt.registerTask('release:bower', releaseTasks.bower);
grunt.registerTask('release:docs', releaseTasks.docs);
grunt.registerTask('release:msg', releaseTasks.msg);
grunt.registerTask('release:starter', releaseTasks.starter);
grunt.registerTask('release', [
'release:setup',
'clean',
'build',
'release:bower',
'release:starter',
'compress',
'release:docs',
'release:msg',
]);

42
LICENSE
View File

@@ -1,31 +1,21 @@
BSD License
For React software
MIT License
Copyright (c) 2013-present, Facebook, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
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:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.

33
PATENTS
View File

@@ -1,33 +0,0 @@
Additional Grant of Patent Rights Version 2
"Software" means the React software distributed by Facebook, Inc.
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
(subject to the termination provision below) license under any Necessary
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
transfer the Software. For avoidance of doubt, no license is granted under
Facebook's rights in any patent claims that are infringed by (i) modifications
to the Software made by you or any third party or (ii) the Software in
combination with any software or other technology.
The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.
A "Necessary Claim" is a claim of a patent owned by Facebook that is
necessarily infringed by the Software standing alone.
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.

View File

@@ -13,11 +13,11 @@ React is a JavaScript library for building user interfaces.
We have several examples [on the website](https://facebook.github.io/react/). Here is the first one to get you started:
```js
var HelloMessage = React.createClass({
render: function() {
class HelloMessage extends React.Component {
render() {
return <div>Hello {this.props.name}</div>;
}
});
}
ReactDOM.render(
<HelloMessage name="John" />,
@@ -27,89 +27,39 @@ ReactDOM.render(
This example will render "Hello John" into a container on the page.
You'll notice that we used an HTML-like syntax; [we call it JSX](https://facebook.github.io/react/docs/jsx-in-depth.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. A simple transform is included with React that allows converting JSX into native JavaScript for browsers to digest.
You'll notice that we used an HTML-like syntax; [we call it JSX](https://facebook.github.io/react/docs/introducing-jsx.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. We recommend using [Babel](https://babeljs.io/) with a [React preset](https://babeljs.io/docs/plugins/preset-react/) to convert JSX into native JavaScript for browsers to digest.
## Installation
The fastest way to get started is to serve JavaScript from a CDN. We're using [npmcdn](https://npmcdn.com/) below but React is also available on [cdnjs](https://cdnjs.com/libraries/react) and [jsdelivr](https://www.jsdelivr.com/projects/react):
React is available as the `react` package on [npm](https://www.npmjs.com/). It is also available on a [CDN](https://facebook.github.io/react/docs/installation.html#using-a-cdn).
```html
<!-- The core React library -->
<script src="https://npmcdn.com/react@15.3.1/dist/react.js"></script>
<!-- The ReactDOM Library -->
<script src="https://npmcdn.com/react-dom@15.3.1/dist/react-dom.js"></script>
```
React is flexible and can be used in a variety of projects. You can create new apps with it, but you can also gradually introduce it into an existing codebase without doing a rewrite.
We've also built a [starter kit](https://facebook.github.io/react/downloads/react-15.3.1.zip) which might be useful if this is your first time using React. It includes a webpage with an example of using React with live code.
The recommended way to install React depends on your project. Here you can find short guides for the most common scenarios:
If you'd like to use [bower](http://bower.io), it's as easy as:
* [Trying Out React](https://facebook.github.io/react/docs/installation.html#trying-out-react)
* [Creating a Single Page Application](https://facebook.github.io/react/docs/installation.html#creating-a-single-page-application)
* [Adding React to an Existing Application](https://facebook.github.io/react/docs/installation.html#adding-react-to-an-existing-application)
```sh
bower install --save react
```
## Contributing
And it's just as easy with [npm](http://npmjs.com):
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. If you're interested in helping with that, check out our [contribution guide](https://facebook.github.io/react/contributing/how-to-contribute.html).
```sh
npm i --save react
```
### [Code of Conduct](https://code.facebook.com/codeofconduct)
## Contribute
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. If you're interested in helping with that, then keep reading. If you're not interested in helping right now that's ok too. :) Any feedback you have about using React would be greatly appreciated.
### Building Your Copy of React
The process to build `react.js` is built entirely on top of node.js, using many libraries you may already be familiar with.
#### Prerequisites
* You have `node` installed at v4.0.0+ and `npm` at v2.0.0+.
* You have `gcc` installed or are comfortable installing a compiler if needed. Some of our `npm` dependencies may require a compliation step. On OS X, the Xcode Command Line Tools will cover this. On Ubuntu, `apt-get install build-essential` will install the required packages. Similar commands should work on other Linux distros. Windows will require some additional steps, see the [`node-gyp` installation instructions](https://github.com/nodejs/node-gyp#installation) for details.
* You are familiar with `npm` and know whether or not you need to use `sudo` when installing packages globally.
* You are familiar with `git`.
#### Build
Once you have the repository cloned, building a copy of `react.js` is really easy.
```sh
# grunt-cli is needed by grunt; you might have this installed already
npm install -g grunt-cli
npm install
grunt build
```
At this point, you should now have a `build/` directory populated with everything you need to use React. The examples should all work.
### Grunt
We use grunt to automate many tasks. Run `grunt -h` to see a mostly complete listing. The important ones to know:
```sh
# Build and run tests with PhantomJS
grunt test
# Lint the code with ESLint
grunt lint
# Wipe out build directory
grunt clean
```
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
### Good First Bug
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first bugs](https://github.com/facebook/react/labels/good%20first%20bug) that contain bugs which are fairly easy to fix. This is a great place to get started.
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first bugs](https://github.com/facebook/react/labels/good%20first%20bug) that contain bugs which are fairly easy to fix. This is a great place to get started.
### License
React is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).
React is [MIT licensed](./LICENSE).
React documentation is [Creative Commons licensed](./LICENSE-docs).
Examples provided in this repository and in the documentation are [separately licensed](./LICENSE-examples).
### More…
There's only so much we can cram in here. To read more about the community and guidelines for submitting pull requests, please read the [Contributing document](CONTRIBUTING.md).
## Troubleshooting
See the [Troubleshooting Guide](https://github.com/facebook/react/wiki/Troubleshooting)

5
addons/.eslintrc Normal file
View File

@@ -0,0 +1,5 @@
{
"rules": {
"comma-dangle": 0
}
}

2
addons/create-react-class/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
create-react-class.js
create-react-class.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,5 @@
# create-react-class
A drop-in replacement for `React.createClass`.
Refer to the [React documentation](https://facebook.github.io/react/docs/react-without-es6.html) for more information.

View File

@@ -0,0 +1,870 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
var _assign = require('object-assign');
var emptyObject = require('fbjs/lib/emptyObject');
var _invariant = require('fbjs/lib/invariant');
if (process.env.NODE_ENV !== 'production') {
var warning = require('fbjs/lib/warning');
}
var MIXINS_KEY = 'mixins';
// Helper function to allow the creation of anonymous functions which do not
// have .name set to the name of the variable being assigned to.
function identity(fn) {
return fn;
}
var ReactPropTypeLocationNames;
if (process.env.NODE_ENV !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
} else {
ReactPropTypeLocationNames = {};
}
function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var injectedMixins = [];
/**
* Composite components are higher-level components that compose other composite
* or host components.
*
* To create a new type of `ReactClass`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return <div>Hello World</div>;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: 'DEFINE_MANY',
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: 'DEFINE_MANY',
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: 'DEFINE_MANY',
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: 'DEFINE_MANY',
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: 'DEFINE_MANY',
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: 'DEFINE_MANY_MERGED',
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: 'DEFINE_MANY_MERGED',
/**
* @return {object}
* @optional
*/
getChildContext: 'DEFINE_MANY_MERGED',
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return <div>Hello, {name}!</div>;
* }
*
* @return {ReactComponent}
* @required
*/
render: 'DEFINE_ONCE',
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: 'DEFINE_MANY',
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: 'DEFINE_MANY',
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: 'DEFINE_MANY',
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: 'DEFINE_ONCE',
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: 'DEFINE_MANY',
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: 'DEFINE_MANY',
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: 'DEFINE_MANY',
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: 'OVERRIDE_BASE'
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function(Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function(Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function(Constructor, childContextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, childContextTypes, 'childContext');
}
Constructor.childContextTypes = _assign(
{},
Constructor.childContextTypes,
childContextTypes
);
},
contextTypes: function(Constructor, contextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, contextTypes, 'context');
}
Constructor.contextTypes = _assign(
{},
Constructor.contextTypes,
contextTypes
);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function(Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(
Constructor.getDefaultProps,
getDefaultProps
);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function(Constructor, propTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, propTypes, 'prop');
}
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
},
statics: function(Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
},
autobind: function() {}
};
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an _invariant so components
// don't show up in prod but only in __DEV__
if (process.env.NODE_ENV !== 'production') {
warning(
typeof typeDef[propName] === 'function',
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
'React.PropTypes.',
Constructor.displayName || 'ReactClass',
ReactPropTypeLocationNames[location],
propName
);
}
}
}
}
function validateMethodOverride(isAlreadyDefined, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name)
? ReactClassInterface[name]
: null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
_invariant(
specPolicy === 'OVERRIDE_BASE',
'ReactClassInterface: You are attempting to override ' +
'`%s` from your class specification. Ensure that your method names ' +
'do not overlap with React methods.',
name
);
}
// Disallow defining methods more than once unless explicitly allowed.
if (isAlreadyDefined) {
_invariant(
specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED',
'ReactClassInterface: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be due ' +
'to a mixin.',
name
);
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classes.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
if (process.env.NODE_ENV !== 'production') {
var typeofSpec = typeof spec;
var isMixinValid = typeofSpec === 'object' && spec !== null;
if (process.env.NODE_ENV !== 'production') {
warning(
isMixinValid,
"%s: You're attempting to include a mixin that is either null " +
'or not an object. Check the mixins included by the component, ' +
'as well as any mixins they include themselves. ' +
'Expected object but got %s.',
Constructor.displayName || 'ReactClass',
spec === null ? null : typeofSpec
);
}
}
return;
}
_invariant(
typeof spec !== 'function',
"ReactClass: You're attempting to " +
'use a component class or function as a mixin. Instead, just use a ' +
'regular object.'
);
_invariant(
!isValidElement(spec),
"ReactClass: You're attempting to " +
'use a component as a mixin. Instead, just use a regular object.'
);
var proto = Constructor.prototype;
var autoBindPairs = proto.__reactAutoBindPairs;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
// mixins are listed before or after these methods in the spec.
if (spec.hasOwnProperty(MIXINS_KEY)) {
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
}
for (var name in spec) {
if (!spec.hasOwnProperty(name)) {
continue;
}
if (name === MIXINS_KEY) {
// We have already handled mixins in a special case above.
continue;
}
var property = spec[name];
var isAlreadyDefined = proto.hasOwnProperty(name);
validateMethodOverride(isAlreadyDefined, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind =
isFunction &&
!isReactClassMethod &&
!isAlreadyDefined &&
spec.autobind !== false;
if (shouldAutoBind) {
autoBindPairs.push(name, property);
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
_invariant(
isReactClassMethod &&
(specPolicy === 'DEFINE_MANY_MERGED' ||
specPolicy === 'DEFINE_MANY'),
'ReactClass: Unexpected spec policy %s for key %s ' +
'when mixing in component specs.',
specPolicy,
name
);
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === 'DEFINE_MANY_MERGED') {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === 'DEFINE_MANY') {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if (process.env.NODE_ENV !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = name in RESERVED_SPEC_KEYS;
_invariant(
!isReserved,
'ReactClass: You are attempting to define a reserved ' +
'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
'as an instance property instead; it will still be accessible on the ' +
'constructor.',
name
);
var isInherited = name in Constructor;
_invariant(
!isInherited,
'ReactClass: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be ' +
'due to a mixin.',
name
);
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
_invariant(
one && two && typeof one === 'object' && typeof two === 'object',
'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
);
for (var key in two) {
if (two.hasOwnProperty(key)) {
_invariant(
one[key] === undefined,
'mergeIntoWithNoDuplicateKeys(): ' +
'Tried to merge two objects with the same key: `%s`. This conflict ' +
'may be due to a mixin; in particular, this may be caused by two ' +
'getInitialState() or getDefaultProps() methods returning objects ' +
'with clashing keys.',
key
);
one[key] = two[key];
}
}
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
var c = {};
mergeIntoWithNoDuplicateKeys(c, a);
mergeIntoWithNoDuplicateKeys(c, b);
return c;
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* Binds a method to the component.
*
* @param {object} component Component whose method is going to be bound.
* @param {function} method Method to be bound.
* @return {function} The bound method.
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if (process.env.NODE_ENV !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
boundMethod.bind = function(newThis) {
for (
var _len = arguments.length,
args = Array(_len > 1 ? _len - 1 : 0),
_key = 1;
_key < _len;
_key++
) {
args[_key - 1] = arguments[_key];
}
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
if (process.env.NODE_ENV !== 'production') {
warning(
false,
'bind(): React component methods may only be bound to the ' +
'component instance. See %s',
componentName
);
}
} else if (!args.length) {
if (process.env.NODE_ENV !== 'production') {
warning(
false,
'bind(): You are binding a component method to the component. ' +
'React does this for you automatically in a high-performance ' +
'way, so you can safely remove this call. See %s',
componentName
);
}
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
var pairs = component.__reactAutoBindPairs;
for (var i = 0; i < pairs.length; i += 2) {
var autoBindKey = pairs[i];
var method = pairs[i + 1];
component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
var IsMountedPreMixin = {
componentDidMount: function() {
this.__isMounted = true;
}
};
var IsMountedPostMixin = {
componentWillUnmount: function() {
this.__isMounted = false;
}
};
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
*/
var ReactClassMixin = {
/**
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
replaceState: function(newState, callback) {
this.updater.enqueueReplaceState(this, newState, callback);
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function() {
if (process.env.NODE_ENV !== 'production') {
warning(
this.__didWarnIsMounted,
'%s: isMounted is deprecated. Instead, make sure to clean up ' +
'subscriptions and pending requests in componentWillUnmount to ' +
'prevent memory leaks.',
(this.constructor && this.constructor.displayName) ||
this.name ||
'Component'
);
this.__didWarnIsMounted = true;
}
return !!this.__isMounted;
}
};
var ReactClassComponent = function() {};
_assign(
ReactClassComponent.prototype,
ReactComponent.prototype,
ReactClassMixin
);
/**
* Creates a composite component class given a class specification.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
function createClass(spec) {
// To keep our warnings more understandable, we'll use a little hack here to
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
// unnecessarily identify a class without displayName as 'Constructor'.
var Constructor = identity(function(props, context, updater) {
// This constructor gets overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
warning(
this instanceof Constructor,
'Something is calling a React component directly. Use a factory or ' +
'JSX instead. See: https://fb.me/react-legacyfactory'
);
}
// Wire up auto-binding
if (this.__reactAutoBindPairs.length) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (
initialState === undefined &&
this.getInitialState._isMockFunction
) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
_invariant(
typeof initialState === 'object' && !Array.isArray(initialState),
'%s.getInitialState(): must return an object or null',
Constructor.displayName || 'ReactCompositeComponent'
);
this.state = initialState;
});
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
Constructor.prototype.__reactAutoBindPairs = [];
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, IsMountedPreMixin);
mixSpecIntoComponent(Constructor, spec);
mixSpecIntoComponent(Constructor, IsMountedPostMixin);
// Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if (process.env.NODE_ENV !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
// initializer or constructor respectively.
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps.isReactClassApproved = {};
}
if (Constructor.prototype.getInitialState) {
Constructor.prototype.getInitialState.isReactClassApproved = {};
}
}
_invariant(
Constructor.prototype.render,
'createClass(...): Class specification must implement a `render` method.'
);
if (process.env.NODE_ENV !== 'production') {
warning(
!Constructor.prototype.componentShouldUpdate,
'%s has a method called ' +
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
'The name is phrased as a question because the function is ' +
'expected to return a value.',
spec.displayName || 'A component'
);
warning(
!Constructor.prototype.componentWillRecieveProps,
'%s has a method called ' +
'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
spec.displayName || 'A component'
);
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
return Constructor;
}
return createClass;
}
module.exports = factory;

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
var React = require('react');
var factory = require('./factory');
if (typeof React === 'undefined') {
throw Error(
'create-react-class could not find the React object. If you are using script tags, ' +
'make sure that React is being loaded before create-react-class.'
);
}
// Hack to grab NoopUpdateQueue from isomorphic React
var ReactNoopUpdateQueue = new React.Component().updater;
module.exports = factory(
React.Component,
React.isValidElement,
ReactNoopUpdateQueue
);

View File

@@ -0,0 +1,46 @@
{
"name": "create-react-class",
"version": "15.6.2",
"description": "Legacy API for creating React components.",
"main": "index.js",
"license": "MIT",
"files": [
"LICENSE",
"factory.js",
"index.js",
"create-react-class.js",
"create-react-class.min.js"
],
"repository": "facebook/react",
"keywords": [
"react"
],
"bugs": {
"url": "https://github.com/facebook/react/issues"
},
"homepage": "https://facebook.github.io/react/",
"dependencies": {
"fbjs": "^0.8.9",
"loose-envify": "^1.3.1",
"object-assign": "^4.1.1"
},
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./create-react-class.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./create-react-class.min.js jest",
"build": "npm run build:dev && npm run build:prod",
"prepublish": "npm test && npm run build"
},
"devDependencies": {
"jest": "^19.0.2",
"prop-types": "^15.5.10",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"webpack": "^2.6.1"
},
"browserify": {
"transform": [
"loose-envify"
]
}
}

View File

@@ -0,0 +1,525 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
var PropTypes;
var React;
var ReactDOM;
var createReactClass;
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
// Suppress warning expectations for prod builds
function suppressDevMatcher(obj, name) {
const original = obj[name];
obj[name] = function devMatcher() {
try {
original.apply(this, arguments);
} catch (e) {
// skip
}
};
}
function expectDev(actual) {
const expectation = expect(actual);
if (process.env.NODE_ENV === 'production') {
Object.keys(expectation).forEach(name => {
suppressDevMatcher(expectation, name);
suppressDevMatcher(expectation.not, name);
});
}
return expectation;
}
function renderIntoDocument(element) {
var node = document.createElement('div');
return ReactDOM.render(element, node);
}
describe('ReactClass-spec', () => {
beforeEach(() => {
PropTypes = require('prop-types');
React = require('react');
ReactDOM = require('react-dom');
createReactClass = require(process.env.TEST_ENTRY);
});
it('should throw when `render` is not specified', () => {
expect(function() {
createReactClass({});
}).toThrowError(
'createClass(...): Class specification must implement a `render` method.'
);
});
// TODO: Update babel-plugin-transform-react-display-name
xit('should copy `displayName` onto the Constructor', () => {
var TestComponent = createReactClass({
render: function() {
return <div />;
}
});
expect(TestComponent.displayName).toBe('TestComponent');
});
it('should copy prop types onto the Constructor', () => {
var propValidator = jest.fn();
var TestComponent = createReactClass({
propTypes: {
value: propValidator
},
render: function() {
return <div />;
}
});
expect(TestComponent.propTypes).toBeDefined();
expect(TestComponent.propTypes.value).toBe(propValidator);
});
it('should warn on invalid prop types', () => {
spyOn(console, 'error');
createReactClass({
displayName: 'Component',
propTypes: {
prop: null
},
render: function() {
return <span>{this.props.prop}</span>;
}
});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: Component: prop type `prop` is invalid; ' +
'it must be a function, usually from React.PropTypes.'
);
});
it('should warn on invalid context types', () => {
spyOn(console, 'error');
createReactClass({
displayName: 'Component',
contextTypes: {
prop: null
},
render: function() {
return <span>{this.props.prop}</span>;
}
});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: Component: context type `prop` is invalid; ' +
'it must be a function, usually from React.PropTypes.'
);
});
it('should throw on invalid child context types', () => {
spyOn(console, 'error');
createReactClass({
displayName: 'Component',
childContextTypes: {
prop: null
},
render: function() {
return <span>{this.props.prop}</span>;
}
});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: Component: child context type `prop` is invalid; ' +
'it must be a function, usually from React.PropTypes.'
);
});
it('should warn when mispelling shouldComponentUpdate', () => {
spyOn(console, 'error');
createReactClass({
componentShouldUpdate: function() {
return false;
},
render: function() {
return <div />;
}
});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: A component has a method called componentShouldUpdate(). Did you ' +
'mean shouldComponentUpdate()? The name is phrased as a question ' +
'because the function is expected to return a value.'
);
createReactClass({
displayName: 'NamedComponent',
componentShouldUpdate: function() {
return false;
},
render: function() {
return <div />;
}
});
expectDev(console.error.calls.count()).toBe(2);
expectDev(console.error.calls.argsFor(1)[0]).toBe(
'Warning: NamedComponent has a method called componentShouldUpdate(). Did you ' +
'mean shouldComponentUpdate()? The name is phrased as a question ' +
'because the function is expected to return a value.'
);
});
it('should warn when mispelling componentWillReceiveProps', () => {
spyOn(console, 'error');
createReactClass({
componentWillRecieveProps: function() {
return false;
},
render: function() {
return <div />;
}
});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: A component has a method called componentWillRecieveProps(). Did you ' +
'mean componentWillReceiveProps()?'
);
});
it('should throw if a reserved property is in statics', () => {
expect(function() {
createReactClass({
statics: {
getDefaultProps: function() {
return {
foo: 0
};
}
},
render: function() {
return <span />;
}
});
}).toThrowError(
'ReactClass: You are attempting to define a reserved property, ' +
'`getDefaultProps`, that shouldn\'t be on the "statics" key. Define ' +
'it as an instance property instead; it will still be accessible on ' +
'the constructor.'
);
});
// TODO: Consider actually moving these to statics or drop this unit test.
xit('should warn when using deprecated non-static spec keys', () => {
spyOn(console, 'error');
createReactClass({
mixins: [{}],
propTypes: {
foo: PropTypes.string
},
contextTypes: {
foo: PropTypes.string
},
childContextTypes: {
foo: PropTypes.string
},
render: function() {
return <div />;
}
});
expectDev(console.error.calls.count()).toBe(4);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'createClass(...): `mixins` is now a static property and should ' +
'be defined inside "statics".'
);
expectDev(console.error.calls.argsFor(1)[0]).toBe(
'createClass(...): `propTypes` is now a static property and should ' +
'be defined inside "statics".'
);
expectDev(console.error.calls.argsFor(2)[0]).toBe(
'createClass(...): `contextTypes` is now a static property and ' +
'should be defined inside "statics".'
);
expectDev(console.error.calls.argsFor(3)[0]).toBe(
'createClass(...): `childContextTypes` is now a static property and ' +
'should be defined inside "statics".'
);
});
it('should support statics', () => {
var Component = createReactClass({
statics: {
abc: 'def',
def: 0,
ghi: null,
jkl: 'mno',
pqr: function() {
return this;
}
},
render: function() {
return <span />;
}
});
var instance = <Component />;
instance = renderIntoDocument(instance);
expect(instance.constructor.abc).toBe('def');
expect(Component.abc).toBe('def');
expect(instance.constructor.def).toBe(0);
expect(Component.def).toBe(0);
expect(instance.constructor.ghi).toBe(null);
expect(Component.ghi).toBe(null);
expect(instance.constructor.jkl).toBe('mno');
expect(Component.jkl).toBe('mno');
expect(instance.constructor.pqr()).toBe(Component);
expect(Component.pqr()).toBe(Component);
});
it('should work with object getInitialState() return values', () => {
var Component = createReactClass({
getInitialState: function() {
return {
occupation: 'clown'
};
},
render: function() {
return <span />;
}
});
var instance = <Component />;
instance = renderIntoDocument(instance);
expect(instance.state.occupation).toEqual('clown');
});
it('renders based on context getInitialState', () => {
var Foo = createReactClass({
contextTypes: {
className: PropTypes.string
},
getInitialState() {
return {className: this.context.className};
},
render() {
return <span className={this.state.className} />;
}
});
var Outer = createReactClass({
childContextTypes: {
className: PropTypes.string
},
getChildContext() {
return {className: 'foo'};
},
render() {
return <Foo />;
}
});
var container = document.createElement('div');
ReactDOM.render(<Outer />, container);
expect(container.firstChild.className).toBe('foo');
});
it('should throw with non-object getInitialState() return values', () => {
spyOn(console, 'error');
[['an array'], 'a string', 1234].forEach(function(state) {
var Component = createReactClass({
getInitialState: function() {
return state;
},
render: function() {
return <span />;
}
});
var instance = <Component />;
expect(function() {
instance = renderIntoDocument(instance);
}).toThrowError(
'Component.getInitialState(): must return an object or null'
);
});
});
it('should work with a null getInitialState() return value', () => {
var Component = createReactClass({
getInitialState: function() {
return null;
},
render: function() {
return <span />;
}
});
expect(() => renderIntoDocument(<Component />)).not.toThrow();
});
it('should throw when using legacy factories', () => {
spyOn(console, 'error');
var Component = createReactClass({
render() {
return <div />;
}
});
expect(() => Component()).toThrow();
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toBe(
'Warning: Something is calling a React component directly. Use a ' +
'factory or JSX instead. See: https://fb.me/react-legacyfactory'
);
});
it('replaceState and callback works', () => {
var ops = [];
var Component = createReactClass({
getInitialState() {
return {step: 0};
},
render() {
ops.push('Render: ' + this.state.step);
return <div />;
}
});
var instance = renderIntoDocument(<Component />);
instance.replaceState({step: 1}, () => {
ops.push('Callback: ' + instance.state.step);
});
expect(ops).toEqual(['Render: 0', 'Render: 1', 'Callback: 1']);
});
it('isMounted works', () => {
spyOn(console, 'error');
var ops = [];
var instance;
var Component = createReactClass({
displayName: 'MyComponent',
mixins: [
{
componentWillMount() {
this.log('mixin.componentWillMount');
},
componentDidMount() {
this.log('mixin.componentDidMount');
},
componentWillUpdate() {
this.log('mixin.componentWillUpdate');
},
componentDidUpdate() {
this.log('mixin.componentDidUpdate');
},
componentWillUnmount() {
this.log('mixin.componentWillUnmount');
}
}
],
log(name) {
ops.push(`${name}: ${this.isMounted()}`);
},
getInitialState() {
this.log('getInitialState');
return {};
},
componentWillMount() {
this.log('componentWillMount');
},
componentDidMount() {
this.log('componentDidMount');
},
componentWillUpdate() {
this.log('componentWillUpdate');
},
componentDidUpdate() {
this.log('componentDidUpdate');
},
componentWillUnmount() {
this.log('componentWillUnmount');
},
render() {
instance = this;
this.log('render');
return <div />;
}
});
var container = document.createElement('div');
ReactDOM.render(<Component />, container);
ReactDOM.render(<Component />, container);
ReactDOM.unmountComponentAtNode(container);
instance.log('after unmount');
expect(ops).toEqual([
'getInitialState: false',
'mixin.componentWillMount: false',
'componentWillMount: false',
'render: false',
'mixin.componentDidMount: true',
'componentDidMount: true',
'mixin.componentWillUpdate: true',
'componentWillUpdate: true',
'render: true',
'mixin.componentDidUpdate: true',
'componentDidUpdate: true',
'mixin.componentWillUnmount: true',
'componentWillUnmount: true',
'after unmount: false'
]);
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toEqual(
'Warning: MyComponent: isMounted is deprecated. Instead, make sure to ' +
'clean up subscriptions and pending requests in componentWillUnmount ' +
'to prevent memory leaks.'
);
});
});

View File

@@ -0,0 +1,59 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'createReactClass',
libraryTarget: 'umd',
filename: __DEV__ ? 'create-react-class.js' : 'create-react-class.min.js'
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
}
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

71
addons/postbuild.js Normal file
View File

@@ -0,0 +1,71 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* 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';
var fs = require('fs');
var path = require('path');
// This lets us import Webpack config without crashing
process.env.NODE_ENV = 'development';
// This script runs from the addon folder
var exportName = require(path.resolve(process.cwd(), './webpack.config')).output
.library;
var packageName = path.basename(process.cwd());
if (packageName.indexOf('react-addons') !== 0) {
throw new Error(
'Only run this script for packages that used to be published as addons.'
);
}
// Inputs
// DEV: root["exportName"] = factory(root["React"])
// PROD: e.exportName=t(e.React)
var find = new RegExp(
'((?!exports)\\b\\w+)(\\["' +
exportName +
'"\\]|\\.' +
exportName +
')\\s*=\\s*(\\w+)\\((.*)\\)'
);
// Outputs
// DEV: (root.React ? (root.React.addons = root.React.addons || {}) : /* throw */).exportName = factory(/* ... */);
// PROD: (e.React ? (e.React.addons = e.React.addons || {}) : /* throw */).exportName = t(/* ... */)
var throwIIFE = [
'(function(){',
'throw new Error("' +
packageName +
' could not find the React object. If you are using script tags, make sure that React is being loaded before ' +
packageName +
'.")',
'})()'
].join('');
var replace =
'($1.React?($1.React.addons=$1.React.addons||{}):' +
throwIIFE +
').' +
exportName +
'=$3($4)';
console.log('Tweaking the development UMD...');
var devUMD = fs.readFileSync('./' + packageName + '.js', 'utf8').toString();
devUMD = devUMD.replace(find, replace);
fs.writeFileSync('./' + packageName + '.js', devUMD);
console.log('Tweaking the production UMD...');
var prodUMD = fs
.readFileSync('./' + packageName + '.min.js', 'utf8')
.toString();
prodUMD = prodUMD.replace(find, replace);
fs.writeFileSync('./' + packageName + '.min.js', prodUMD);
console.log('Done.');
console.log('Note that you need to manually test the UMD builds.');

View File

@@ -0,0 +1,2 @@
react-addons-create-fragment.js
react-addons-create-fragment.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,77 @@
# react-addons-create-fragment
>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.
>The recommended migration path is to use arrays with explicit keys on individual elements.
**Importing**
```javascript
import createFragment from 'react-addons-create-fragment'; // ES6
var createFragment = require('react-addons-create-fragment'); // ES5 with npm
```
If you prefer a `<script>` tag, you can get it from `React.addons.createFragment` with:
```html
<!-- development version -->
<script src="https://unpkg.com/react-addons-create-fragment/react-addons-create-fragment.js"></script>
<!-- production version -->
<script src="https://unpkg.com/react-addons-create-fragment/react-addons-create-fragment.min.js"></script>
```
In this case, make sure to put the `<script>` tag after React.
## Overview
In most cases, you can use the `key` prop to specify keys on the elements you're returning from `render`. However, this breaks down in one situation: if you have two sets of children that you need to reorder, there's no way to put a key on each set without adding a wrapper element.
That is, if you have a component such as:
```js
function Swapper(props) {
let children;
if (props.swapped) {
children = [props.rightChildren, props.leftChildren];
} else {
children = [props.leftChildren, props.rightChildren];
}
return <div>{children}</div>;
}
```
The children will unmount and remount as you change the `swapped` prop because there aren't any keys marked on the two sets of children.
To solve this problem, you can use the `createFragment` add-on to give keys to the sets of children.
#### `Array<ReactNode> createFragment(object children)`
Instead of creating arrays, we write:
```javascript
import createFragment from 'react-addons-create-fragment';
function Swapper(props) {
let children;
if (props.swapped) {
children = createFragment({
right: props.rightChildren,
left: props.leftChildren
});
} else {
children = createFragment({
left: props.leftChildren,
right: props.rightChildren
});
}
return <div>{children}</div>;
}
```
The keys of the passed object (that is, `left` and `right`) are used as keys for the entire set of children, and the order of the object's keys is used to determine the order of the rendered children. With this change, the two sets of children will be properly reordered in the DOM without unmounting.
The return value of `createFragment` should be treated as an opaque object; you can use the [`React.Children`](https://facebook.github.io/react/docs/react-api.html#react.children) helpers to loop through a fragment but should not access it directly. Note also that we're relying on the JavaScript engine preserving object enumeration order here, which is not guaranteed by the spec but is implemented by all major browsers and VMs for objects with non-numeric keys.

View File

@@ -0,0 +1,346 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var React = require('react');
var REACT_ELEMENT_TYPE =
(typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) ||
0xeac7;
var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var SEPARATOR = '.';
var SUBSEPARATOR = ':';
var didWarnAboutMaps = false;
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
function getIteratorFn(maybeIterable) {
var iteratorFn =
maybeIterable &&
((ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL]) ||
maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = ('' + key).replace(escapeRegex, function(match) {
return escaperLookup[match];
});
return '$' + escapedString;
}
function getComponentKey(component, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (component && typeof component === 'object' && component.key != null) {
// Explicit key
return escape(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
function traverseAllChildrenImpl(
children,
nameSoFar,
callback,
traverseContext
) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (
children === null ||
type === 'string' ||
type === 'number' ||
// The following is inlined from ReactElement. This means we can optimize
// some checks. React Fiber also inlines this logic for similar purposes.
(type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE)
) {
callback(
traverseContext,
children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar
);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
callback,
traverseContext
);
}
} else {
var iteratorFn = getIteratorFn(children);
if (iteratorFn) {
if (process.env.NODE_ENV !== 'production') {
// Warn about using Maps as children
if (iteratorFn === children.entries) {
warning(
didWarnAboutMaps,
'Using Maps as children is unsupported and will likely yield ' +
'unexpected results. Convert it to a sequence/iterable of keyed ' +
'ReactElements instead.'
);
didWarnAboutMaps = true;
}
}
var iterator = iteratorFn.call(children);
var step;
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
callback,
traverseContext
);
}
} else if (type === 'object') {
var addendum = '';
if (process.env.NODE_ENV !== 'production') {
addendum =
' If you meant to render a collection of children, use an array ' +
'instead or wrap the object using createFragment(object) from the ' +
'React add-ons.';
}
var childrenString = '' + children;
invariant(
false,
'Objects are not valid as a React child (found: %s).%s',
childrenString === '[object Object]'
? 'object with keys {' + Object.keys(children).join(', ') + '}'
: childrenString,
addendum
);
}
}
return subtreeCount;
}
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
var userProvidedKeyEscapeRegex = /\/+/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
}
function cloneAndReplaceKey(oldElement, newKey) {
return React.cloneElement(
oldElement,
{key: newKey},
oldElement.props !== undefined ? oldElement.props.children : undefined
);
}
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
var oneArgumentPooler = function(copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var addPoolingTo = function addPoolingTo(CopyConstructor, pooler) {
// Casting as any so that flow ignores the actual implementation and trusts
// it to match the type we declared
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var standardReleaser = function standardReleaser(instance) {
var Klass = this;
invariant(
instance instanceof Klass,
'Trying to release an instance into a pool of a different type.'
);
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var fourArgumentPooler = function fourArgumentPooler(a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;
this.context = mapContext;
this.count = 0;
}
MapBookKeeping.prototype.destructor = function() {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result;
var keyPrefix = bookKeeping.keyPrefix;
var func = bookKeeping.func;
var context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(
mappedChild,
result,
childKey,
emptyFunction.thatReturnsArgument
);
} else if (mappedChild != null) {
if (React.isValidElement(mappedChild)) {
mappedChild = cloneAndReplaceKey(
mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix +
(mappedChild.key && (!child || child.key !== mappedChild.key)
? escapeUserProvidedKey(mappedChild.key) + '/'
: '') +
childKey
);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(
array,
escapedPrefix,
func,
context
);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}
var numericPropertyRegex = /^\d+$/;
var warnedAboutNumeric = false;
function createReactFragment(object) {
if (typeof object !== 'object' || !object || Array.isArray(object)) {
warning(
false,
'React.addons.createFragment only accepts a single object. Got: %s',
object
);
return object;
}
if (React.isValidElement(object)) {
warning(
false,
'React.addons.createFragment does not accept a ReactElement ' +
'without a wrapper object.'
);
return object;
}
invariant(
object.nodeType !== 1,
'React.addons.createFragment(...): Encountered an invalid child; DOM ' +
'elements are not valid children of React components.'
);
var result = [];
for (var key in object) {
if (process.env.NODE_ENV !== 'production') {
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
warning(
false,
'React.addons.createFragment(...): Child objects should have ' +
'non-numeric keys so ordering is preserved.'
);
warnedAboutNumeric = true;
}
}
mapIntoWithKeyPrefixInternal(
object[key],
result,
key,
emptyFunction.thatReturnsArgument
);
}
return result;
}
module.exports = createReactFragment;

View File

@@ -0,0 +1,41 @@
{
"name": "react-addons-create-fragment",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"dependencies": {
"fbjs": "^0.8.4",
"loose-envify": "^1.3.1",
"object-assign": "^4.1.0"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"react-addons-create-fragment.js",
"react-addons-create-fragment.min.js"
],
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./react-addons-create-fragment.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./react-addons-create-fragment.min.js jest",
"build": "npm run build:dev && npm run build:prod && node ../postbuild.js",
"prepublish": "npm test && npm run build"
},
"devDependencies": {
"jest": "^19.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"webpack": "^2.6.1"
},
"browserify": {
"transform": [
"loose-envify"
]
}
}

View File

@@ -0,0 +1,131 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* 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';
var React;
var createReactFragment;
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
// Suppress warning expectations for prod builds
function suppressDevMatcher(obj, name) {
const original = obj[name];
obj[name] = function devMatcher() {
try {
original.apply(this, arguments);
} catch (e) {
// skip
}
};
}
function expectDev(actual) {
const expectation = expect(actual);
if (process.env.NODE_ENV === 'production') {
Object.keys(expectation).forEach(name => {
suppressDevMatcher(expectation, name);
suppressDevMatcher(expectation.not, name);
});
}
return expectation;
}
describe('createReactFragment', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
createReactFragment = require(process.env.TEST_ENTRY);
});
it('warns for numeric keys on objects as children', () => {
spyOn(console, 'error');
createReactFragment({
1: React.createElement('span'),
2: React.createElement('span')
});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'Child objects should have non-numeric keys so ordering is preserved.'
);
});
it('should warn if passing null to createFragment', () => {
spyOn(console, 'error');
createReactFragment(null);
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'React.addons.createFragment only accepts a single object.'
);
});
it('should warn if passing an array to createFragment', () => {
spyOn(console, 'error');
createReactFragment([]);
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'React.addons.createFragment only accepts a single object.'
);
});
it('should warn if passing a ReactElement to createFragment', () => {
spyOn(console, 'error');
createReactFragment(React.createElement('div'));
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain(
'React.addons.createFragment does not accept a ReactElement without a ' +
'wrapper object.'
);
});
});

View File

@@ -0,0 +1,61 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'createFragment',
libraryTarget: 'umd',
filename: __DEV__
? 'react-addons-create-fragment.js'
: 'react-addons-create-fragment.min.js'
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
}
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,17 @@
# react-addons-css-transition-group
The code in this package has moved. We recommend you to use `CSSTransitionGroup` from [`react-transition-group`](https://github.com/reactjs/react-transition-group) instead.
In particular, its version `1.x` is a drop-in replacement for the last released version of `react-addons-css-transition-group`.
Run `npm install --save react-transition-group@1.x`, and replace the imports in your code:
```js
// Old
import CSSTransitionGroup from 'react-addons-css-transition-group';
// New
import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup';
```
The documentation branch for `react-transition-group@1.x` [can be found here](https://github.com/reactjs/react-transition-group/tree/v1-stable#high-level-api-csstransitiongroup).

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = require('react-transition-group/CSSTransitionGroup');

View File

@@ -0,0 +1,25 @@
{
"name": "react-addons-css-transition-group",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"scripts": {
"prepublish": ":"
},
"dependencies": {
"react-transition-group": "^1.2.0"
},
"files": [
"LICENSE",
"README.md",
"index.js"
],
"peerDependencies": {
"react": "^15.4.2"
}
}

View File

@@ -0,0 +1,114 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
asap@~2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
chain-function@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.0.tgz#0d4ab37e7e18ead0bdc47b920764118ce58733dc"
core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
dom-helpers@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.2.1.tgz#3203e07fed217bd1f424b019735582fc37b2825a"
encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
iconv-lite "~0.4.13"
fbjs@^0.8.9:
version "0.8.12"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
dependencies:
core-js "^1.0.0"
isomorphic-fetch "^2.1.1"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^0.7.9"
iconv-lite@~0.4.13:
version "0.4.17"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
is-stream@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"
js-tokens@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
loose-envify@^1.0.0, loose-envify@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
js-tokens "^3.0.0"
node-fetch@^1.0.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"
object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
promise@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
dependencies:
asap "~2.0.3"
prop-types@^15.5.6:
version "15.5.10"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.3.1"
react-transition-group@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.0.tgz#b51fc921b0c3835a7ef7c571c79fc82c73e9204f"
dependencies:
chain-function "^1.0.0"
dom-helpers "^3.2.0"
loose-envify "^1.3.1"
prop-types "^15.5.6"
warning "^3.0.0"
setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
ua-parser-js@^0.7.9:
version "0.7.12"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
warning@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c"
dependencies:
loose-envify "^1.0.0"
whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"

View File

@@ -0,0 +1,2 @@
react-addons-linked-state-mixin.js
react-addons-linked-state-mixin.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,109 @@
# react-addons-linked-state-mixin
>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.
>The recommended migration path is to explicitly set `value` and the `onChange` handler instead of using `LinkedStateMixin`.
**Importing `LinkedStateMixin`**
```javascript
import LinkedStateMixin from 'react-addons-linked-state-mixin'; // ES6
var LinkedStateMixin = require('react-addons-linked-state-mixin'); // ES5 with npm
```
If you prefer a `<script>` tag, you can get it from `React.addons.LinkedStateMixin` with:
```html
<!-- development version -->
<script src="https://unpkg.com/react-addons-linked-state-mixin/react-addons-linked-state-mixin.js"></script>
<!-- production version -->
<script src="https://unpkg.com/react-addons-linked-state-mixin/react-addons-linked-state-mixin.min.js"></script>
```
In this case, make sure to put the `<script>` tag after React.
**Importing `LinkedInput`**
After React 16, you will also need `LinkedInput` component if you want to keep using this pattern. You can import it like this:
```javascript
import LinkedInput from 'react-linked-input'; // ES6
var LinkedInput = require('react-linked-input'); // ES5 with npm
```
If you prefer a `<script>` tag, you can get it from `LinkedInput` global with:
```html
<!-- development version -->
<script src="https://unpkg.com/react-linked-input/react-linked-input.js"></script>
<!-- production version -->
<script src="https://unpkg.com/react-linked-input/react-linked-input.min.js"></script>
```
## Overview
`LinkedStateMixin` is an easy way to express two-way binding with React.
In React, data flows one way: from owner to child. We think that this makes your app's code easier to understand. You can think of it as "one-way data binding."
However, there are lots of applications that require you to read some data and flow it back into your program. For example, when developing forms, you'll often want to update some React `state` when you receive user input. Or perhaps you want to perform layout in JavaScript and react to changes in some DOM element size.
In React, you would implement this by listening to a "change" event, read from your data source (usually the DOM) and call `setState()` on one of your components. "Closing the data flow loop" explicitly leads to more understandable and easier-to-maintain programs. See [our forms documentation](https://facebook.github.io/react/docs/forms.html) for more information.
Two-way binding -- implicitly enforcing that some value in the DOM is always consistent with some React `state` -- is concise and supports a wide variety of applications. We've provided `LinkedStateMixin`: syntactic sugar for setting up the common data flow loop pattern described above, or "linking" some data source to React `state`.
> Note:
>
> `LinkedStateMixin` is just a thin wrapper and convention around the `onChange`/`setState()` pattern. It doesn't fundamentally change how data flows in your React application.
## LinkedStateMixin: Before and After
Here's a simple form example without using `LinkedStateMixin`:
```javascript
var createReactClass = require('create-react-class');
var NoLink = createReactClass({
getInitialState: function() {
return {message: 'Hello!'};
},
handleChange: function(event) {
this.setState({message: event.target.value});
},
render: function() {
var message = this.state.message;
return <input type="text" value={message} onChange={this.handleChange} />;
}
});
```
This works really well and it's very clear how data is flowing, however, with a lot of form fields it could get a bit verbose. Let's use `LinkedStateMixin` to save us some typing:
```javascript
var createReactClass = require('create-react-class');
var LinkedInput = require('react-linked-input');
var WithLink = createReactClass({
mixins: [LinkedStateMixin],
getInitialState: function() {
return {message: 'Hello!'};
},
render: function() {
return <LinkedInput type="text" valueLink={this.linkState('message')} />;
}
});
```
`LinkedStateMixin` adds a method to your React component called `linkState()`. `linkState()` returns a `valueLink` object which contains the current value of the React state and a callback to change it. The `LinkInput` component passes those properties to the input it renders.
`valueLink` objects can be passed up and down the tree as props, so it's easy (and explicit) to set up two-way binding between a component deep in the hierarchy and state that lives higher in the hierarchy.
Note that checkboxes have a special behavior regarding their `value` attribute, which is the value that will be sent on form submit if the checkbox is checked (defaults to `on`). The `value` attribute is not updated when the checkbox is checked or unchecked. For checkboxes, you should use `checkedLink` instead of `valueLink`:
```
<LinkedInput type="checkbox" checkedLink={this.linkState('booleanValue')} />
```

View File

@@ -0,0 +1,156 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
/**
* ReactLink encapsulates a common pattern in which a component wants to modify
* a prop received from its parent. ReactLink allows the parent to pass down a
* value coupled with a callback that, when invoked, expresses an intent to
* modify that value. For example:
*
* React.createClass({
* getInitialState: function() {
* return {value: ''};
* },
* render: function() {
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
* _handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
*
* We have provided some sugary mixins to make the creation and
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
/**
* Deprecated: An an easy way to express two-way binding with React.
* See https://facebook.github.io/react/docs/two-way-binding-helpers.html
*
* @param {*} value current value of the link
* @param {function} requestChange callback to request a change
*/
function ReactLink(value, requestChange) {
this.value = value;
this.requestChange = requestChange;
}
var ReactStateSetters = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* @param {ReactCompositeComponent} component
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(component, funcReturningState) {
return function(a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {ReactCompositeComponent} component
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
}
};
function createStateKeySetter(component, key) {
// Partial state is allocated outside of the function closure so it can be
// reused with every call, avoiding memory allocation when this function
// is called.
var partialState = {};
return function stateKeySetter(value) {
partialState[key] = value;
component.setState(partialState);
};
}
ReactStateSetters.Mixin = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateSetter(function(xValue) {
* return {x: xValue};
* })(1);
*
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateKeySetter('x')(1);
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
/**
* A simple mixin around ReactLink.forState().
* See https://facebook.github.io/react/docs/two-way-binding-helpers.html
*/
var LinkedStateMixin = {
/**
* Create a ReactLink that's linked to part of this component's state. The
* ReactLink will have the current value of this.state[key] and will call
* setState() when a change is requested.
*
* @param {string} key state key to update.
* @return {ReactLink} ReactLink instance linking to the state.
*/
linkState: function(key) {
return new ReactLink(
this.state[key],
ReactStateSetters.createStateKeySetter(this, key)
);
}
};
module.exports = LinkedStateMixin;

View File

@@ -0,0 +1,36 @@
{
"name": "react-addons-linked-state-mixin",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"dependencies": {
"fbjs": "^0.8.4",
"object-assign": "^4.1.0"
},
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./react-addons-linked-state-mixin.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./react-addons-linked-state-mixin.min.js jest",
"build": "npm run build:dev && npm run build:prod && node ../postbuild.js",
"prepublish": "npm test && npm run build"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"react-addons-linked-state-mixin.js",
"react-addons-linked-state-mixin.min.js"
],
"devDependencies": {
"create-react-class": "^15.5.4",
"jest": "^19.0.2",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"webpack": "^2.6.1"
}
}

View File

@@ -0,0 +1,131 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* 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';
let LinkedStateMixin;
let createReactClass;
let React;
let ReactDOM;
let ReactTestUtils;
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
describe('LinkedStateMixin', () => {
beforeEach(() => {
jest.resetModules();
createReactClass = require('create-react-class');
React = require('react');
ReactDOM = require('react-dom');
ReactTestUtils = require('react-dom/test-utils');
LinkedStateMixin = require(process.env.TEST_ENTRY);
});
// https://facebook.github.io/react/docs/two-way-binding-helpers.html#linkedstatemixin-before-and-after
it('should work with valueLink', () => {
spyOn(console, 'error'); // Ignore deprecated valueLink message for now
const WithLink = createReactClass({
mixins: [LinkedStateMixin],
getInitialState: function() {
return {message: 'Hello!'};
},
render: function() {
return <input type="text" valueLink={this.linkState('message')} />;
}
});
const instance = ReactTestUtils.renderIntoDocument(
React.createElement(WithLink)
);
expect(instance.state.message).toBe('Hello!');
const node = ReactDOM.findDOMNode(instance);
node.value = 'Goodbye!';
ReactTestUtils.Simulate.change(node);
expect(instance.state.message).toBe('Goodbye!');
});
// https://facebook.github.io/react/docs/two-way-binding-helpers.html#linkedstatemixin-without-valuelink
it('should work without valueLink', () => {
const WithoutLink = createReactClass({
mixins: [LinkedStateMixin],
getInitialState: function() {
return {message: 'Hello!'};
},
render: function() {
var valueLink = this.linkState('message');
var handleChange = function(e) {
valueLink.requestChange(e.target.value);
};
return (
<input type="text" value={valueLink.value} onChange={handleChange} />
);
}
});
const instance = ReactTestUtils.renderIntoDocument(
React.createElement(WithoutLink)
);
expect(instance.state.message).toBe('Hello!');
const node = ReactDOM.findDOMNode(instance);
node.value = 'Goodbye!';
ReactTestUtils.Simulate.change(node);
expect(instance.state.message).toBe('Goodbye!');
});
});

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'LinkedStateMixin',
libraryTarget: 'umd',
filename: __DEV__
? 'react-addons-linked-state-mixin.js'
: 'react-addons-linked-state-mixin.min.js'
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
react-addons-pure-render-mixin.js
react-addons-pure-render-mixin.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,52 @@
# react-addons-pure-render-mixin
>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.
>The recommended migration path is to use [`React.PureComponent`](https://facebook.github.io/react/docs/react-api.html#react.purecomponent) instead.
**Importing**
```javascript
import PureRenderMixin from 'react-addons-pure-render-mixin'; // ES6
var PureRenderMixin = require('react-addons-pure-render-mixin'); // ES5 with npm
```
If you prefer a `<script>` tag, you can get it from `React.addons.PureRenderMixin` with:
```html
<!-- development version -->
<script src="https://unpkg.com/react-addons-pure-render-mixin/react-addons-pure-render-mixin.js"></script>
<!-- production version -->
<script src="https://unpkg.com/react-addons-pure-render-mixin/react-addons-pure-render-mixin.min.js"></script>
```
In this case, make sure to put the `<script>` tag after React.
## Overview
If your React component's render function renders the same result given the same props and state, you can use this mixin for a performance boost in some cases.
Example:
```js
const createReactClass = require('create-react-class');
createReactClass({
mixins: [PureRenderMixin],
render: function() {
return <div className={this.props.className}>foo</div>;
}
});
```
Under the hood, the mixin implements [shouldComponentUpdate](https://facebook.github.io/react/docs/component-specs.html#updating-shouldcomponentupdate), in which it compares the current props and state with the next ones and returns `false` if the equalities pass.
> Note:
>
> This only shallowly compares the objects. If these contain complex data structures, it may produce false-negatives for deeper differences. Only mix into components which have simple props and state, or use `forceUpdate()` when you know deep data structures have changed. Or, consider using [immutable objects](https://facebook.github.io/immutable-js/) to facilitate fast comparisons of nested data.
>
> Furthermore, `shouldComponentUpdate` skips updates for the whole component subtree. Make sure all the children components are also "pure".

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
var shallowEqual = require('fbjs/lib/shallowEqual');
module.exports = {
shouldComponentUpdate: function(nextProps, nextState) {
return (
!shallowEqual(this.props, nextProps) ||
!shallowEqual(this.state, nextState)
);
}
};

View File

@@ -0,0 +1,35 @@
{
"name": "react-addons-pure-render-mixin",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"dependencies": {
"fbjs": "^0.8.4",
"object-assign": "^4.1.0"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"react-addons-pure-render-mixin.js",
"react-addons-pure-render-mixin.min.js"
],
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./react-addons-pure-render-mixin.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./react-addons-pure-render-mixin.min.js jest",
"build": "npm run build:dev && npm run build:prod && node ../postbuild.js",
"prepublish": "npm test && npm run build"
},
"devDependencies": {
"jest": "^19.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"webpack": "^2.6.1"
}
}

View File

@@ -1,10 +1,8 @@
/**
* Copyright 2015-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2015-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
*/
@@ -12,35 +10,81 @@
'use strict';
var React;
var ReactDOM;
var ReactComponentWithPureRenderMixin;
var ReactTestUtils;
describe('ReactComponentWithPureRenderMixin', function() {
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
beforeEach(function() {
React = require('React');
ReactComponentWithPureRenderMixin =
require('ReactComponentWithPureRenderMixin');
ReactTestUtils = require('ReactTestUtils');
function renderIntoDocument(element) {
var node = document.createElement('div');
return ReactDOM.render(element, node);
}
describe('PureRenderMixin', () => {
beforeEach(() => {
React = require('react');
ReactDOM = require('react-dom');
ReactComponentWithPureRenderMixin = require(process.env.TEST_ENTRY);
});
it('provides a default shouldComponentUpdate implementation', function() {
it('provides a default shouldComponentUpdate implementation', () => {
var renderCalls = 0;
class PlasticWrap extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
color: 'green',
color: 'green'
};
}
render() {
return (
<Apple
color={this.state.color}
ref="apple"
/>
);
return React.createElement(Apple, {
color: this.state.color,
ref: 'apple'
});
}
}
@@ -50,30 +94,30 @@ describe('ReactComponentWithPureRenderMixin', function() {
getInitialState: function() {
return {
cut: false,
slices: 1,
slices: 1
};
},
cut: function() {
this.setState({
cut: true,
slices: 10,
slices: 10
});
},
eatSlice: function() {
this.setState({
slices: this.state.slices - 1,
slices: this.state.slices - 1
});
},
render: function() {
renderCalls++;
return <div />;
},
return React.createElement('div');
}
});
var instance = ReactTestUtils.renderIntoDocument(<PlasticWrap />);
var instance = renderIntoDocument(React.createElement(PlasticWrap));
expect(renderCalls).toBe(1);
// Do not re-render based on props
@@ -97,11 +141,11 @@ describe('ReactComponentWithPureRenderMixin', function() {
expect(renderCalls).toBe(4);
});
it('does not do a deep comparison', function() {
it('does not do a deep comparison', () => {
function getInitialState() {
return {
foo: [1, 2, 3],
bar: {a: 4, b: 5, c: 6},
bar: {a: 4, b: 5, c: 6}
};
}
@@ -117,17 +161,17 @@ describe('ReactComponentWithPureRenderMixin', function() {
render: function() {
renderCalls++;
return <div />;
},
return React.createElement('div');
}
});
var instance = ReactTestUtils.renderIntoDocument(<Component />);
var instance = renderIntoDocument(React.createElement(Component));
expect(renderCalls).toBe(1);
// Do not re-render if state is equal
var settings = {
foo: initialSettings.foo,
bar: initialSettings.bar,
bar: initialSettings.bar
};
instance.setState(settings);
expect(renderCalls).toBe(1);
@@ -141,5 +185,4 @@ describe('ReactComponentWithPureRenderMixin', function() {
instance.setState(getInitialState());
expect(renderCalls).toBe(3);
});
});

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'PureRenderMixin',
libraryTarget: 'umd',
filename: __DEV__
? 'react-addons-pure-render-mixin.js'
: 'react-addons-pure-render-mixin.min.js'
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
react-addons-shallow-compare.js
react-addons-shallow-compare.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,53 @@
# react-addons-shallow-compare
>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.
>The recommended migration path is to use [`React.PureComponent`](https://facebook.github.io/react/docs/react-api.html#react.purecomponent) instead.
**Importing**
```javascript
import shallowCompare from 'react-addons-shallow-compare'; // ES6
var shallowCompare = require('react-addons-shallow-compare'); // ES5 with npm
```
If you prefer a `<script>` tag, you can get it from `React.addons.shallowCompare` with:
```html
<!-- development version -->
<script src="https://unpkg.com/react-addons-shallow-compare/react-addons-shallow-compare.js"></script>
<!-- production version -->
<script src="https://unpkg.com/react-addons-shallow-compare/react-addons-shallow-compare.min.js"></script>
```
In this case, make sure to put the `<script>` tag after React.
## Overview
Before [`React.PureComponent`](https://facebook.github.io/react/docs/react-api.html#react.purecomponent) was introduced, `shallowCompare` was commonly used to achieve the same functionality as [`PureRenderMixin`](https://www.npmjs.com/package/react-addons-pure-render-mixin) while using ES6 classes with React.
If your React component's render function is "pure" (in other words, it renders the same result given the same props and state), you can use this helper function for a performance boost in some cases.
Example:
```js
export class SampleComponent extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
render() {
return <div className={this.props.className}>foo</div>;
}
}
```
`shallowCompare` performs a shallow equality check on the current `props` and `nextProps` objects as well as the current `state` and `nextState` objects.
It does this by iterating on the keys of the objects being compared and returning true when the values of a key in each object are not strictly equal.
`shallowCompare` returns `true` if the shallow comparison for props or state fails and therefore the component should update.
`shallowCompare` returns `false` if the shallow comparison for props and state both pass and therefore the component does not need to update.

View File

@@ -0,0 +1,26 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule shallowCompare
*/
'use strict';
var shallowEqual = require('fbjs/lib/shallowEqual');
/**
* Does a shallow comparison for props and state.
* See ReactComponentWithPureRenderMixin
* See also https://facebook.github.io/react/docs/shallow-compare.html
*/
function shallowCompare(instance, nextProps, nextState) {
return (
!shallowEqual(instance.props, nextProps) ||
!shallowEqual(instance.state, nextState)
);
}
module.exports = shallowCompare;

View File

@@ -0,0 +1,35 @@
{
"name": "react-addons-shallow-compare",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"dependencies": {
"fbjs": "^0.8.4",
"object-assign": "^4.1.0"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"react-addons-shallow-compare.js",
"react-addons-shallow-compare.min.js"
],
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./react-addons-shallow-compare.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./react-addons-shallow-compare.min.js jest",
"build": "npm run build:dev && npm run build:prod && node ../postbuild.js",
"prepublish": "npm test && npm run build"
},
"devDependencies": {
"jest": "^19.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"webpack": "^2.6.1"
}
}

View File

@@ -0,0 +1,269 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* 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';
var React;
var ReactDOM;
var shallowCompare;
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
function renderIntoDocument(element) {
var node = document.createElement('div');
return ReactDOM.render(element, node);
}
// Tests adapted from ReactComponentWithPureRendererMixin and ReactPureComponent tests
describe('shallowCompare', () => {
beforeEach(() => {
React = require('react');
ReactDOM = require('react-dom');
shallowCompare = require(process.env.TEST_ENTRY);
});
it('should render', () => {
var renders = 0;
class Component extends React.Component {
constructor() {
super();
this.state = {type: 'mushrooms'};
}
render() {
renders++;
return React.createElement('div', null, this.props.text[0]);
}
shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
}
var container = document.createElement('div');
var text;
var component;
text = ['porcini'];
component = ReactDOM.render(
React.createElement(Component, {text}),
container
);
expect(container.textContent).toBe('porcini');
expect(renders).toBe(1);
text = ['morel'];
component = ReactDOM.render(
React.createElement(Component, {text}),
container
);
expect(container.textContent).toBe('morel');
expect(renders).toBe(2);
text[0] = 'portobello';
component = ReactDOM.render(
React.createElement(Component, {text}),
container
);
expect(container.textContent).toBe('morel');
expect(renders).toBe(2);
// Setting state without changing it doesn't cause a rerender.
component.setState({type: 'mushrooms'});
expect(container.textContent).toBe('morel');
expect(renders).toBe(2);
// But changing state does.
component.setState({type: 'portobello mushrooms'});
expect(container.textContent).toBe('portobello');
expect(renders).toBe(3);
});
it('can override shouldComponentUpdate', () => {
var renders = 0;
class Component extends React.PureComponent {
render() {
renders++;
return React.createElement('div');
}
shouldComponentUpdate() {
return true;
}
}
var container = document.createElement('div');
ReactDOM.render(React.createElement(Component), container);
ReactDOM.render(React.createElement(Component), container);
expect(renders).toBe(2);
});
it('provides a default shouldComponentUpdate implementation', () => {
var renderCalls = 0;
class PlasticWrap extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
color: 'green'
};
}
shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
render() {
return React.createElement(Apple, {
color: this.state.color,
ref: 'apple'
});
}
}
var Apple = React.createClass({
getInitialState: function() {
return {
cut: false,
slices: 1
};
},
cut: function() {
this.setState({
cut: true,
slices: 10
});
},
eatSlice: function() {
this.setState({
slices: this.state.slices - 1
});
},
shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
},
render: function() {
renderCalls++;
return React.createElement('div');
}
});
var instance = renderIntoDocument(React.createElement(PlasticWrap));
expect(renderCalls).toBe(1);
// Do not re-render based on props
instance.setState({color: 'green'});
expect(renderCalls).toBe(1);
// Re-render based on props
instance.setState({color: 'red'});
expect(renderCalls).toBe(2);
// Re-render base on state
instance.refs.apple.cut();
expect(renderCalls).toBe(3);
// No re-render based on state
instance.refs.apple.cut();
expect(renderCalls).toBe(3);
// Re-render based on state again
instance.refs.apple.eatSlice();
expect(renderCalls).toBe(4);
});
it('does not do a deep comparison', () => {
function getInitialState() {
return {
foo: [1, 2, 3],
bar: {a: 4, b: 5, c: 6}
};
}
var renderCalls = 0;
var initialSettings = getInitialState();
var Component = React.createClass({
shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
},
getInitialState: function() {
return initialSettings;
},
render: function() {
renderCalls++;
return React.createElement('div');
}
});
var instance = renderIntoDocument(React.createElement(Component));
expect(renderCalls).toBe(1);
// Do not re-render if state is equal
var settings = {
foo: initialSettings.foo,
bar: initialSettings.bar
};
instance.setState(settings);
expect(renderCalls).toBe(1);
// Re-render because one field changed
initialSettings.foo = [1, 2, 3];
instance.setState(initialSettings);
expect(renderCalls).toBe(2);
// Re-render because the object changed
instance.setState(getInitialState());
expect(renderCalls).toBe(3);
});
});

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'shallowCompare',
libraryTarget: 'umd',
filename: __DEV__
? 'react-addons-shallow-compare.js'
: 'react-addons-shallow-compare.min.js'
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,9 @@
# react-addons-test-utils
This package provides the React TestUtils add-on.
See <https://facebook.github.io/react/docs/test-utils.html> for more information.
This package is deprecated as of version 15.5.0:
* TestUtils have been moved to `react-dom/test-utils`
* Shallow renderer has been moved to `react-test-renderer/shallow`

73
addons/react-addons-test-utils/index.js vendored Normal file
View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var lowPriorityWarning = function lowPriorityWarning() {};
if (process.env.NODE_ENV !== 'production') {
var printWarning = function(format) {
for (
var _len = arguments.length,
args = Array(_len > 1 ? _len - 1 : 0),
_key = 1;
_key < _len;
_key++
) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message =
'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.warn(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
lowPriorityWarning = function(condition, format) {
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (!condition) {
for (
var _len2 = arguments.length,
args = Array(_len2 > 2 ? _len2 - 2 : 0),
_key2 = 2;
_key2 < _len2;
_key2++
) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
// This package has been deprecated in NPM as of version 15.5.0
// But NPM deprecation warnings are easy to overlook
// So a more explicit runtime warning seemed appropriate
lowPriorityWarning(
false,
'ReactTestUtils has been moved to react-dom/test-utils. ' +
'Update references to remove this warning.'
);
module.exports = require('react-dom/lib/ReactTestUtils');

View File

@@ -0,0 +1,28 @@
{
"name": "react-addons-test-utils",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"peerDependencies": {
"react-dom": "^15.4.2"
},
"scripts": {
"test": "jest",
"prepublish": "npm test"
},
"devDependencies": {
"jest": "^19.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"files": [
"LICENSE",
"README.md",
"index.js"
]
}

56
addons/react-addons-test-utils/test.js vendored Normal file
View File

@@ -0,0 +1,56 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
describe('ReactTestUtils', function() {
let React;
beforeEach(function() {
spyOn(console, 'warn');
React = require('react');
});
it('should warn on include', function() {
require('./index');
expect(console.warn).toHaveBeenCalledWith(
'Warning: ReactTestUtils has been moved to react-dom/test-utils. ' +
'Update references to remove this warning.'
);
});
it('should pass a basic smoke test', function() {
const ReactTestUtils = require('./index');
const onClick = jest.fn();
class MyComponent extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {bar: 123};
}
render() {
return <div onClick={onClick}>{this.props.baz}</div>;
}
}
const instance = ReactTestUtils.renderIntoDocument(
<MyComponent baz="abc" />
);
expect(instance.state.bar).toBe(123);
expect(instance.props.baz).toBe('abc');
const div = ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'div');
expect(div.textContent).toBe('abc');
expect(onClick).not.toHaveBeenCalled();
ReactTestUtils.Simulate.click(div);
expect(onClick).toHaveBeenCalled();
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,17 @@
# react-addons-transition-group
The code in this package has moved. We recommend you to use `TransitionGroup` from [`react-transition-group`](https://github.com/reactjs/react-transition-group) instead.
In particular, its version `1.x` is a drop-in replacement for the last released version of `react-addons-transition-group`.
Run `npm install --save react-transition-group@1.x`, and replace the imports in your code:
```js
// Old
import TransitionGroup from 'react-addons-transition-group';
// New
import TransitionGroup from 'react-transition-group/TransitionGroup';
```
The documentation branch for `react-transition-group@1.x` [can be found here](https://github.com/reactjs/react-transition-group/tree/v1-stable#low-level-api-transitiongroup).

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = require('react-transition-group/TransitionGroup');

View File

@@ -0,0 +1,25 @@
{
"name": "react-addons-transition-group",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"dependencies": {
"react-transition-group": "^1.2.0"
},
"peerDependencies": {
"react": "^15.4.2"
},
"scripts": {
"prepublish": ":"
},
"files": [
"LICENSE",
"README.md",
"index.js"
]
}

View File

@@ -0,0 +1,114 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
asap@~2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
chain-function@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.0.tgz#0d4ab37e7e18ead0bdc47b920764118ce58733dc"
core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
dom-helpers@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.2.1.tgz#3203e07fed217bd1f424b019735582fc37b2825a"
encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
iconv-lite "~0.4.13"
fbjs@^0.8.9:
version "0.8.12"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
dependencies:
core-js "^1.0.0"
isomorphic-fetch "^2.1.1"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^0.7.9"
iconv-lite@~0.4.13:
version "0.4.17"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
is-stream@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"
js-tokens@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
loose-envify@^1.0.0, loose-envify@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
js-tokens "^3.0.0"
node-fetch@^1.0.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"
object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
promise@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
dependencies:
asap "~2.0.3"
prop-types@^15.5.6:
version "15.5.10"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.3.1"
react-transition-group@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.0.tgz#b51fc921b0c3835a7ef7c571c79fc82c73e9204f"
dependencies:
chain-function "^1.0.0"
dom-helpers "^3.2.0"
loose-envify "^1.3.1"
prop-types "^15.5.6"
warning "^3.0.0"
setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
ua-parser-js@^0.7.9:
version "0.7.12"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
warning@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c"
dependencies:
loose-envify "^1.0.0"
whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"

2
addons/react-addons-update/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
react-addons-update.js
react-addons-update.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,125 @@
# react-addons-update
>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.
>The recommended migration path is to use [`immutability-helper`](https://github.com/kolodny/immutability-helper). Its version `1.0.0` is a drop-in replacement.
**Importing**
```javascript
import update from 'react-addons-update'; // ES6
var update = require('react-addons-update'); // ES5 with npm
```
If you prefer a `<script>` tag, you can get it from `React.addons.update` with:
```html
<!-- development version -->
<script src="https://unpkg.com/react-addons-update/react-addons-update.js"></script>
<!-- production version -->
<script src="https://unpkg.com/react-addons-update/react-addons-update.min.js"></script>
```
In this case, make sure to put the `<script>` tag after React.
## Overview
React lets you use whatever style of data management you want, including mutation. However, if you can use immutable data in performance-critical parts of your application it's easy to implement a fast [`shouldComponentUpdate()`](https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate) method to significantly speed up your app.
Dealing with immutable data in JavaScript is more difficult than in languages designed for it, like [Clojure](http://clojure.org/). However, we've provided a simple immutability helper, `update()`, that makes dealing with this type of data much easier, *without* fundamentally changing how your data is represented. You can also take a look at Facebook's [Immutable-js](https://facebook.github.io/immutable-js/docs/) and the [Optimizing Performance](https://facebook.github.io/react/docs/optimizing-performance.html) section for more detail on Immutable-js.
### The Main Idea
If you mutate data like this:
```js
myData.x.y.z = 7;
// or...
myData.a.b.push(9);
```
You have no way of determining which data has changed since the previous copy has been overwritten. Instead, you need to create a new copy of `myData` and change only the parts of it that need to be changed. Then you can compare the old copy of `myData` with the new one in `shouldComponentUpdate()` using triple-equals:
```js
const newData = deepCopy(myData);
newData.x.y.z = 7;
newData.a.b.push(9);
```
Unfortunately, deep copies are expensive, and sometimes impossible. You can alleviate this by only copying objects that need to be changed and by reusing the objects that haven't changed. Unfortunately, in today's JavaScript this can be cumbersome:
```js
const newData = extend(myData, {
x: extend(myData.x, {
y: extend(myData.x.y, {z: 7}),
}),
a: extend(myData.a, {b: myData.a.b.concat(9)})
});
```
While this is fairly performant (since it only makes a shallow copy of `log n` objects and reuses the rest), it's a big pain to write. Look at all the repetition! This is not only annoying, but also provides a large surface area for bugs.
## `update()`
`update()` provides simple syntactic sugar around this pattern to make writing this code easier. This code becomes:
```js
import update from 'react-addons-update';
const newData = update(myData, {
x: {y: {z: {$set: 7}}},
a: {b: {$push: [9]}}
});
```
While the syntax takes a little getting used to (though it's inspired by [MongoDB's query language](http://docs.mongodb.org/manual/core/crud-introduction/#query)) there's no redundancy, it's statically analyzable and it's not much more typing than the mutative version.
The `$`-prefixed keys are called *commands*. The data structure they are "mutating" is called the *target*.
## Available Commands
* `{$push: array}` `push()` all the items in `array` on the target.
* `{$unshift: array}` `unshift()` all the items in `array` on the target.
* `{$splice: array of arrays}` for each item in `arrays` call `splice()` on the target with the parameters provided by the item.
* `{$set: any}` replace the target entirely.
* `{$merge: object}` merge the keys of `object` with the target.
* `{$apply: function}` passes in the current value to the function and updates it with the new returned value.
## Examples
### Simple push
```js
const initialArray = [1, 2, 3];
const newArray = update(initialArray, {$push: [4]}); // => [1, 2, 3, 4]
```
`initialArray` is still `[1, 2, 3]`.
### Nested collections
```js
const collection = [1, 2, {a: [12, 17, 15]}];
const newCollection = update(collection, {2: {a: {$splice: [[1, 1, 13, 14]]}}});
// => [1, 2, {a: [12, 13, 14, 15]}]
```
This accesses `collection`'s index `2`, key `a`, and does a splice of one item starting from index `1` (to remove `17`) while inserting `13` and `14`.
### Updating a value based on its current one
```js
const obj = {a: 5, b: 3};
const newObj = update(obj, {b: {$apply: function(x) {return x * 2;}}});
// => {a: 5, b: 6}
// This is equivalent, but gets verbose for deeply nested collections:
const newObj2 = update(obj, {b: {$set: obj.b * 2}});
```
### (Shallow) Merge
```js
const obj = {a: 5, b: 3};
const newObj = update(obj, {$merge: {b: 6, c: 7}}); // => {a: 5, b: 6, c: 7}
```

164
addons/react-addons-update/index.js vendored Normal file
View File

@@ -0,0 +1,164 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var _assign = require('object-assign');
var invariant = require('fbjs/lib/invariant');
var hasOwnProperty = {}.hasOwnProperty;
function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
return _assign(new x.constructor(), x);
} else {
return x;
}
}
var COMMAND_PUSH = '$push';
var COMMAND_UNSHIFT = '$unshift';
var COMMAND_SPLICE = '$splice';
var COMMAND_SET = '$set';
var COMMAND_MERGE = '$merge';
var COMMAND_APPLY = '$apply';
var ALL_COMMANDS_LIST = [
COMMAND_PUSH,
COMMAND_UNSHIFT,
COMMAND_SPLICE,
COMMAND_SET,
COMMAND_MERGE,
COMMAND_APPLY
];
var ALL_COMMANDS_SET = {};
ALL_COMMANDS_LIST.forEach(function(command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
invariant(
Array.isArray(value),
'update(): expected target of %s to be an array; got %s.',
command,
value
);
var specValue = spec[command];
invariant(
Array.isArray(specValue),
'update(): expected spec of %s to be an array; got %s. ' +
'Did you forget to wrap your parameter in an array?',
command,
specValue
);
}
/**
* Returns a updated shallow copy of an object without mutating the original.
* See https://facebook.github.io/react/docs/update.html for details.
*/
function update(value, spec) {
invariant(
typeof spec === 'object',
'update(): You provided a key path to update() that did not contain one ' +
'of %s. Did you forget to include {%s: ...}?',
ALL_COMMANDS_LIST.join(', '),
COMMAND_SET
);
if (hasOwnProperty.call(spec, COMMAND_SET)) {
invariant(
Object.keys(spec).length === 1,
'Cannot have more than one key in an object with %s',
COMMAND_SET
);
return spec[COMMAND_SET];
}
var nextValue = shallowCopy(value);
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
invariant(
mergeObj && typeof mergeObj === 'object',
"update(): %s expects a spec of type 'object'; got %s",
COMMAND_MERGE,
mergeObj
);
invariant(
nextValue && typeof nextValue === 'object',
"update(): %s expects a target of type 'object'; got %s",
COMMAND_MERGE,
nextValue
);
_assign(nextValue, spec[COMMAND_MERGE]);
}
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
spec[COMMAND_PUSH].forEach(function(item) {
nextValue.push(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
spec[COMMAND_UNSHIFT].forEach(function(item) {
nextValue.unshift(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
invariant(
Array.isArray(value),
'Expected %s target to be an array; got %s',
COMMAND_SPLICE,
value
);
invariant(
Array.isArray(spec[COMMAND_SPLICE]),
'update(): expected spec of %s to be an array of arrays; got %s. ' +
'Did you forget to wrap your parameters in an array?',
COMMAND_SPLICE,
spec[COMMAND_SPLICE]
);
spec[COMMAND_SPLICE].forEach(function(args) {
invariant(
Array.isArray(args),
'update(): expected spec of %s to be an array of arrays; got %s. ' +
'Did you forget to wrap your parameters in an array?',
COMMAND_SPLICE,
spec[COMMAND_SPLICE]
);
nextValue.splice.apply(nextValue, args);
});
}
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
invariant(
typeof spec[COMMAND_APPLY] === 'function',
'update(): expected spec of %s to be a function; got %s.',
COMMAND_APPLY,
spec[COMMAND_APPLY]
);
nextValue = spec[COMMAND_APPLY](nextValue);
}
for (var k in spec) {
if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
nextValue[k] = update(value[k], spec[k]);
}
}
return nextValue;
}
module.exports = update;

View File

@@ -0,0 +1,33 @@
{
"name": "react-addons-update",
"version": "15.6.2",
"main": "index.js",
"repository": "facebook/react",
"keywords": [
"react",
"react-addon"
],
"license": "MIT",
"dependencies": {
"fbjs": "^0.8.9",
"object-assign": "^4.1.0"
},
"devDependencies": {
"jest": "^19.0.2",
"webpack": "^2.6.1"
},
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./react-addons-update.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./react-addons-update.min.js jest",
"build": "npm run build:dev && npm run build:prod && node ../postbuild.js",
"prepublish": "npm test && npm run build"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"react-addons-update.js",
"react-addons-update.min.js"
]
}

110
addons/react-addons-update/test.js vendored Normal file
View File

@@ -0,0 +1,110 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* 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';
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
const update = require(process.env.TEST_ENTRY);
describe('update', () => {
// https://facebook.github.io/react/docs/update.html#simple-push
it('should support simple push', () => {
const array = [1, 2, 3];
const newArray = update(array, {$push: [4]});
expect(array).toEqual([1, 2, 3]);
expect(newArray).toEqual([1, 2, 3, 4]);
});
// https://facebook.github.io/react/docs/update.html#nested-collections
it('should support nested collections', () => {
const collection = [1, 2, {a: [12, 17, 15]}];
const newCollection = update(collection, {
2: {a: {$splice: [[1, 1, 13, 14]]}}
});
expect(collection).toEqual([1, 2, {a: [12, 17, 15]}]);
expect(newCollection).toEqual([1, 2, {a: [12, 13, 14, 15]}]);
});
// https://facebook.github.io/react/docs/update.html#updating-a-value-based-on-its-current-one
it('should support updating a value based on its current one', () => {
const obj = {a: 5, b: 3};
const newObj = update(obj, {
b: {
$apply: function(x) {
return x * 2;
}
}
});
expect(newObj).toEqual({a: 5, b: 6});
const newObj2 = update(obj, {b: {$set: obj.b * 2}});
expect(newObj2).toEqual({a: 5, b: 6});
expect(obj).toEqual({a: 5, b: 3});
});
// https://facebook.github.io/react/docs/update.html#shallow-merge
it('should support shallow merge', () => {
const obj = {a: 5, b: 3};
const newObj = update(obj, {$merge: {b: 6, c: 7}});
expect(newObj).toEqual({a: 5, b: 6, c: 7});
expect(obj).toEqual({a: 5, b: 3});
});
});

View File

@@ -0,0 +1,51 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'update',
libraryTarget: 'umd',
filename: __DEV__ ? 'react-addons-update.js' : 'react-addons-update.min.js'
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

2
addons/react-linked-input/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
react-linked-input.js
react-linked-input.min.js

View File

@@ -0,0 +1,21 @@
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.

View File

@@ -0,0 +1,11 @@
# react-linked-input
>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.
>The recommended migration path is to set `value` and `onChange` props directly instead of `valueLink` or `checkedLink`.
This component supports the legacy `valueLink` API for `<input>` components. The built-in support for it is being removed from React. This component may be used as a migration plan (so your code doesn't break in React 16) or may be used if you just like the `valueLink` data binding semantics. However, this component is not maintained, so use at your own risk.
For details on how to use it, refer to the [`LinkedStateMixin`](https://www.npmjs.com/package/react-addons-linked-state-mixin) documentation, since they usually appear together.

165
addons/react-linked-input/index.js vendored Normal file
View File

@@ -0,0 +1,165 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var React = require('react');
if (typeof React === 'undefined') {
throw Error(
'react-linked-input could not find the React object. If you are using script tags, ' +
'make sure that React is being loaded before react-linked-input.'
);
}
var invariant = require('fbjs/lib/invariant');
function _assertSingleLink(inputProps) {
invariant(
inputProps.checkedLink == null || inputProps.valueLink == null,
'Cannot provide a checkedLink and a valueLink. If you want to use ' +
"checkedLink, you probably don't want to use valueLink and vice versa."
);
}
function _assertValueLink(inputProps) {
_assertSingleLink(inputProps);
invariant(
inputProps.value == null && inputProps.onChange == null,
'Cannot provide a valueLink and a value or onChange event. If you want ' +
"to use value or onChange, you probably don't want to use valueLink."
);
}
function _assertCheckedLink(inputProps) {
_assertSingleLink(inputProps);
invariant(
inputProps.checked == null && inputProps.onChange == null,
'Cannot provide a checkedLink and a checked property or onChange event. ' +
"If you want to use checked or onChange, you probably don't want to " +
'use checkedLink'
);
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
/**
* @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function(inputProps) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.value;
}
return inputProps.value;
},
/**
* @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function(inputProps) {
if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.value;
}
return inputProps.checked;
},
/**
* @param {object} inputProps Props for form component
* @param {SyntheticEvent} event change event to handle
*/
executeOnChange: function(inputProps, event) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.requestChange(event.target.value);
} else if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.requestChange(event.target.checked);
} else if (inputProps.onChange) {
return inputProps.onChange.call(undefined, event);
}
}
};
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return call && (typeof call === 'object' || typeof call === 'function')
? call
: self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(
'Super expression must either be null or a function, not ' +
typeof superClass
);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(subClass, superClass);
} else {
// eslint-disable-next-line no-proto
subClass.__proto__ = superClass;
}
}
}
var LI = (function(_React$Component) {
_inherits(LinkedInput, _React$Component);
function LinkedInput() {
_classCallCheck(this, LinkedInput);
var _this = _possibleConstructorReturn(this, _React$Component.call(this));
_this.handleChange = _this.handleChange.bind(_this);
return _this;
}
LinkedInput.prototype.handleChange = function handleChange(e) {
LinkedValueUtils.executeOnChange(this.props, e);
};
LinkedInput.prototype.render = function render() {
var newProps = Object.assign({}, this.props);
newProps.value = LinkedValueUtils.getValue(this.props);
newProps.checked = LinkedValueUtils.getChecked(this.props);
newProps.onChange = this.handleChange;
delete newProps.valueLink;
delete newProps.checkedLink;
return React.createElement('input', newProps);
};
return LinkedInput;
})(React.Component);
module.exports = LI;

View File

@@ -0,0 +1,42 @@
{
"name": "react-linked-input",
"version": "15.6.2",
"description": "LinkedInput supports the ReactLink semantics",
"main": "index.js",
"scripts": {
"test": "TEST_ENTRY=./index.js jest",
"build:dev": "NODE_ENV=development webpack && TEST_ENTRY=./react-linked-input.js jest",
"build:prod": "NODE_ENV=production webpack && NODE_ENV=production TEST_ENTRY=./react-linked-input.min.js jest",
"build": "npm run build:dev && npm run build:prod",
"prepublish": "npm test && npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/react.git"
},
"files": [
"LICENSE",
"factory.js",
"index.js",
"react-linked-input.js",
"react-linked-input.min.js"
],
"keywords": [
"react",
"linkedinput",
"input",
"linked",
"reactlink"
],
"license": "MIT",
"devDependencies": {
"babel-preset-es2015": "^6.24.0",
"jest": "^19.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"webpack": "^2.6.1"
},
"dependencies": {
"fbjs": "^0.8.9"
}
}

107
addons/react-linked-input/test.js vendored Normal file
View File

@@ -0,0 +1,107 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
// Catch stray warnings
var env = jasmine.getEnv();
var callCount = 0;
var oldError = console.error;
var newError = function() {
callCount++;
oldError.apply(this, arguments);
};
console.error = newError;
env.beforeEach(() => {
callCount = 0;
jasmine.addMatchers({
toBeReset() {
return {
compare(actual) {
if (actual !== newError && !jasmine.isSpy(actual)) {
return {
pass: false,
message: 'Test did not tear down console.error mock properly.'
};
}
return {pass: true};
}
};
},
toNotHaveBeenCalled() {
return {
compare(actual) {
return {
pass: callCount === 0,
message:
'Expected test not to warn. If the warning is expected, mock ' +
"it out using spyOn(console, 'error'); and test that the " +
'warning occurs.'
};
}
};
}
});
});
env.afterEach(() => {
expect(console.error).toBeReset();
expect(console.error).toNotHaveBeenCalled();
});
function noop() {}
// Tests adapted from ReactComponentWithPureRendererMixin and ReactPureComponent tests
describe('LinkedInput', function() {
let LinkedInput;
let React;
let ReactDOM;
beforeEach(function() {
React = require('react');
ReactDOM = require('react-dom');
LinkedInput = require(process.env.TEST_ENTRY);
});
it('should basically work', function() {
spyOn(console, 'error'); // Unknown prop `requestChange` on <input> tag
const container = document.createElement('div');
const component = ReactDOM.render(
React.createElement(LinkedInput, {
value: 'foo',
onChange: noop
}),
container
);
const input = ReactDOM.findDOMNode(component);
expect(input.value).toBe('foo');
ReactDOM.render(
React.createElement(LinkedInput, {
valueLink: {value: 'boo'},
requestChange: noop
}),
container
);
expect(input.value).toBe('boo');
});
it('should throw', function() {
const container = document.createElement('div');
const element = React.createElement(LinkedInput, {
value: 'foo',
valueLink: {
value: 'boo',
requestChange: noop
}
});
expect(function() {
ReactDOM.render(element, container);
}).toThrow();
});
});

View File

@@ -0,0 +1,59 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* 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';
const webpack = require('webpack');
let __DEV__;
switch (process.env.NODE_ENV) {
case 'development':
__DEV__ = true;
break;
case 'production':
__DEV__ = false;
break;
default:
throw new Error('Unknown environment.');
}
module.exports = {
entry: './index',
output: {
library: 'LinkedInput',
libraryTarget: 'umd',
filename: __DEV__ ? 'react-linked-input.js' : 'react-linked-input.min.js'
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
}
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': __DEV__ ? '"development"' : '"production"'
})
].concat(
__DEV__
? []
: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
})
]
)
};

File diff suppressed because it is too large Load Diff

23
addons/test.js Normal file
View File

@@ -0,0 +1,23 @@
var fs = require('fs');
var path = require('path');
var spawnSync = require('child_process').spawnSync;
function runNpmCommand(dir, args) {
const result = spawnSync('npm', args, {
cwd: path.join(__dirname, dir),
stdio: 'inherit'
});
if (result.status !== 0) {
process.exit('npm test exited with non-zero code.');
}
}
fs
.readdirSync(__dirname)
.filter(file => {
return fs.statSync(path.join(__dirname, file)).isDirectory();
})
.forEach(dir => {
runNpmCommand(dir, ['install']);
runNpmCommand(dir, ['run', 'prepublish']);
});

46
circle.yml Normal file
View File

@@ -0,0 +1,46 @@
---
machine:
timezone: America/Los_Angeles
node:
version: 6
ruby:
version: 2.2.3
environment:
TRAVIS_REPO_SLUG: facebook/react
YARN_VERSION: 0.17.8
PATH: "${PATH}:${HOME}/.yarn/bin"
dependencies:
pre:
# This is equivalent to $TRAVIS_COMMIT_RANGE
# Need to figure out how to bail early if this is a "docs only" build
- echo $CIRCLE_COMPARE_URL | cut -d/ -f7
# install yarn if it's not already installed
- |
if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
fi
override:
- bundle install --gemfile=docs/Gemfile --deployment --path=vendor/bundle --jobs=3 --retry=3
- yarn install
- scripts/circleci/set_up_github_keys.sh
post:
# - npm ls --depth=0
cache_directories:
- docs/vendor/bundle
- .grunt # Show size comparisons between builds
- ~/react-gh-pages # docs checkout
- ~/.yarn
- ~/.yarn-cache
test:
override:
- ./scripts/circleci/test_entry_point.sh:
parallel: true
deployment:
staging:
branch: /.*/
commands:
- ./scripts/circleci/upload_build.sh
- ./scripts/circleci/build_gh_pages.sh

View File

@@ -65,6 +65,3 @@ DEPENDENCIES
rb-fsevent
redcarpet
sanitize (~> 2.0)
BUNDLED WITH
1.11.2

View File

@@ -34,7 +34,7 @@ Use Jekyll to serve the website locally (by default, at `http://localhost:4000`)
$ cd react/docs
$ bundle exec rake
$ bundle exec jekyll serve -w
$ open http://localhost:4000/react/
$ open http://localhost:4000/react/index.html
```
We use [SASS](http://sass-lang.com/) (with [Bourbon](http://bourbon.io/)) for our CSS, and we use JSX to transform some of our JS.

View File

@@ -6,8 +6,8 @@ require('open-uri')
desc "download babel-browser"
task :fetch_remotes do
IO.copy_stream(
open('https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js'),
'js/babel-browser.min.js'
open('https://unpkg.com/babel-standalone@6.15.0/babel.min.js'),
'js/babel.min.js'
)
end

View File

@@ -2,9 +2,9 @@
name: React
description: A JavaScript library for building user interfaces
url: https://facebook.github.io
baseurl: "/react"
permalink: "/blog/:year/:month/:day/:title.html"
paginate_path: "/blog/page:num/"
baseurl: /react
permalink: /blog/:year/:month/:day/:title.html
paginate_path: /blog/page:num/
paginate: 5
timezone: America/Los_Angeles
highlighter: pygments
@@ -20,22 +20,29 @@ defaults:
type: pages
values:
sectionid: blog
- scope:
path: tutorial
type: pages
values:
layout: tutorial
sectionid: tutorial
- scope:
path: docs
type: pages
values:
layout: docs
sectionid: docs
- scope:
path: tips
type: pages
values:
sectionid: docs
- scope:
path: contributing
type: pages
values:
sectionid: docs
- scope:
path: community
type: pages
values:
layout: community
sectionid: community
exclude:
- Gemfile
- Gemfile.lock
@@ -53,13 +60,13 @@ sass:
gems:
- jekyll-redirect-from
- jekyll-paginate
react_version: 15.3.0
react_version: 15.6.2
react_hashes:
dev: R8v794QN9hrNjnivoQ3Mf7nMGVwFIHBkUmBanB40ZBIMttZbBEUatXNosjytvPUC
prod: asiNTW+3f/iCKtm+05EX+4V4n6R5R1fyAY9M8Md0DLHodFResXMSBlt8ns9iJaPK
addons_dev: iR3HmJX+5siYwRvy6ZXWWN/dNP4IuItUsfk0JJmwxaBIYtWHZhK/2N7wrAcxmpS8
addons_prod: A/63GcxBS05SAxTWB0+wQKyQl8RVEH3nOuBuxwg/WV6yI5qpfEy4ksn90bqJdFJY
dom_dev: PKr8yTHUBD0chzmoJ6ZYtB1nB87GTEWPmuDlDV7iARDrYGki2fmVB0ae3vf3LX0O
dom_prod: TBEslZF7tpwiuBgt/ajgWUKvDGuCExkmEoWygscHE/OOajWS24BLAaf2/z7lj/9n
dom_server_dev: UxEqwIE5+BLQKOqKHnPfJBOrSDo7HyocIl6sTb6taLayrVmDuhQ5VM4iauS54BbK
dom_server_prod: hOLRkO2HGPRi0d73qKZWueHZyDD/6BID0CJax9kNUNaAvMR4atbNIcYfk2BoM8T3
dev: buVLzxzBI8Ps3svVMSUurNdb5dozNidH5Ow4H0YgZeia3t6Oeui2VLpvtAq1fwtK
prod: nCjsa0kjNQPQdxWm12/ReVJzfBJaVubEwwDswyQDGMKYJmeWv3qShMuETfU5fisu
addons_dev: /u97pKzBwasbC1yj8gSIq1z30o4ZTUX9j1Mv/hyAjmG41ydTNHw9JFOhwFbDgxmR
addons_prod: /p86n4b5VTlWoA/INEHQZ+zjx9g1pJduoFmTEJ6fSzFTq1mBaXaBcWVGtZJXD68L
dom_dev: lUxkeWjg3I3lXmxcM1gvgo0yvm2w9alc1osa4L8yWZFO6l/vg9h5hSlHPFioltrm
dom_prod: u8x1yIGN9IjGNYbBaDMsp1D4MK3sCmMU13mcBX+bm+aMo5+gaT8HIwIj39GlXaRS
dom_server_dev: Okj1hVX1VF+oZSkPcJQ/YcnW6bsIpeni222ylwUaMnSmdCe0zWKmMwpFMVqzy4Ws
dom_server_prod: wiA4u+G5fEfF4xzhhVnNWeSifVyttoEIpgc3APaMKQgw5A4wHbEMihf63tk1qoyt

View File

@@ -112,8 +112,6 @@ li {
line-height: 20px;
}
a {
color: $linkColor;
text-decoration: none;
@@ -131,3 +129,7 @@ a {
.center {
text-align: center;
}
input {
font-family: inherit;
}

View File

@@ -1,6 +1,9 @@
# Map of short name to more information. `name` will be used but if you don't
# want to use your real name, just use whatever. If url is included, your name
# will be a link to the provided url.
acdlite:
name: Andrew Clark
url: https://twitter.com/acdlite
benigeri:
name: Paul Benigeri
url: https://github.com/benigeri
@@ -13,6 +16,9 @@ Daniel15:
fisherwebdev:
name: Bill Fisher
url: https://twitter.com/fisherwebdev
flarnie:
name: Flarnie Marchan
url: https://twitter.com/ProbablyFlarnie
gaearon:
name: Dan Abramov
url: https://twitter.com/dan_abramov
@@ -43,6 +49,9 @@ LoukaN:
matthewjohnston4:
name: Matthew Johnston
url: https://github.com/matthewathome
nhunzaker:
name: Nathan Hunzaker
url: https://github.com/nhunzaker
petehunt:
name: Pete Hunt
url: https://twitter.com/floydophone

View File

@@ -0,0 +1,14 @@
- title: Community Resources
items:
- id: support
title: Where To Get Support
- id: conferences
title: Conferences
- id: videos
title: Videos
- id: complementary-tools
title: Complementary Tools
href: https://github.com/facebook/react/wiki/Complementary-Tools
- id: examples
title: Examples
href: https://github.com/facebook/react/wiki/Examples

View File

@@ -1,4 +1,10 @@
- title: Contributing
items:
- id: how-to-contribute
title: How to Contribute
- id: codebase-overview
title: Codebase Overview
- id: implementation-notes
title: Implementation Notes
- id: design-principles
title: Design Principles

View File

@@ -1,104 +1,75 @@
- title: Quick Start
items:
- id: getting-started
title: Getting Started
- id: tutorial
title: Tutorial
- id: thinking-in-react
title: Thinking in React
- title: Community Resources
- id: installation
title: Installation
- id: hello-world
title: Hello World
- id: introducing-jsx
title: Introducing JSX
- id: rendering-elements
title: Rendering Elements
- id: components-and-props
title: Components and Props
- id: state-and-lifecycle
title: State and Lifecycle
- id: handling-events
title: Handling Events
- id: conditional-rendering
title: Conditional Rendering
- id: lists-and-keys
title: Lists and Keys
- id: forms
title: Forms
- id: lifting-state-up
title: Lifting State Up
- id: composition-vs-inheritance
title: Composition vs Inheritance
- id: thinking-in-react
title: Thinking In React
- title: Advanced Guides
items:
- id: conferences
title: Conferences
- id: videos
title: Videos
- id: complementary-tools
title: Complementary Tools
href: https://github.com/facebook/react/wiki/Complementary-Tools
- id: examples
title: Examples
href: https://github.com/facebook/react/wiki/Examples
- title: Guides
items:
- id: why-react
title: Why React?
- id: displaying-data
title: Displaying Data
subitems:
- id: jsx-in-depth
title: JSX in Depth
- id: jsx-spread
title: JSX Spread Attributes
- id: jsx-gotchas
title: JSX Gotchas
- id: interactivity-and-dynamic-uis
title: Interactivity and Dynamic UIs
- id: multiple-components
title: Multiple Components
- id: reusable-components
title: Reusable Components
- id: transferring-props
title: Transferring Props
- id: forms
title: Forms
- id: working-with-the-browser
title: Working With the Browser
subitems:
- id: more-about-refs
title: Refs to Components
- id: tooling-integration
title: Tooling Integration
subitems:
- id: language-tooling
title: Language Tooling
- id: package-management
title: Package Management
- id: environments
title: Server-side Environments
- id: addons
title: Add-Ons
subitems:
- id: animation
title: Animation
- id: two-way-binding-helpers
title: Two-Way Binding Helpers
- id: test-utils
title: Test Utilities
- id: clone-with-props
title: Cloning Elements
- id: create-fragment
title: Keyed Fragments
- id: update
title: Immutability Helpers
- id: pure-render-mixin
title: PureRenderMixin
- id: perf
title: Performance Tools
- id: shallow-compare
title: Shallow Compare
- id: advanced-performance
title: Advanced Performance
- id: context
title: Context
title: JSX In Depth
- id: typechecking-with-proptypes
title: Typechecking With PropTypes
- id: refs-and-the-dom
title: Refs and the DOM
- id: uncontrolled-components
title: Uncontrolled Components
- id: optimizing-performance
title: Optimizing Performance
- id: react-without-es6
title: React Without ES6
- id: react-without-jsx
title: React Without JSX
- id: reconciliation
title: Reconciliation
- id: context
title: Context
- id: web-components
title: Web Components
- id: higher-order-components
title: Higher-Order Components
- id: integrating-with-other-libraries
title: Integrating with Other Libraries
- id: accessibility
title: Accessibility
- title: Reference
items:
- id: top-level-api
title: Top-Level API
- id: component-api
title: Component API
- id: component-specs
title: Component Specs and Lifecycle
- id: tags-and-attributes
title: Supported Tags and Attributes
- id: events
title: Event System
- id: dom-differences
title: DOM Differences
- id: special-non-dom-attributes
title: Special Non-DOM Attributes
- id: reconciliation
title: Reconciliation
- id: webcomponents
title: Web Components
- id: glossary
title: React (Virtual) DOM Terminology
- id: react-api
title: React
subitems:
- id: react-component
title: React.Component
- id: react-dom
title: ReactDOM
- id: react-dom-server
title: ReactDOMServer
- id: dom-elements
title: DOM Elements
- id: events
title: SyntheticEvent
- id: test-utils
title: Test Utilities
- id: shallow-renderer
title: Shallow Renderer

View File

@@ -1,38 +0,0 @@
- title: Tips
items:
- id: introduction
title: Introduction
- id: inline-styles
title: Inline Styles
- id: if-else-in-JSX
title: If-Else in JSX
- id: self-closing-tag
title: Self-Closing Tag
- id: maximum-number-of-jsx-root-nodes
title: Maximum Number of JSX Root Nodes
- id: style-props-value-px
title: Shorthand for Specifying Pixel Values in style props
- id: children-props-type
title: Type of the Children props
- id: controlled-input-null-value
title: Value of null for Controlled Input
- id: componentWillReceiveProps-not-triggered-after-mounting
title: componentWillReceiveProps Not Triggered After Mounting
- id: props-in-getInitialState-as-anti-pattern
title: Props in getInitialState Is an Anti-Pattern
- id: dom-event-listeners
title: DOM Event Listeners in a Component
- id: initial-ajax
title: Load Initial Data via AJAX
- id: false-in-jsx
title: False in JSX
- id: communicate-between-components
title: Communicate Between Components
- id: expose-component-functions
title: Expose Component Functions
- id: children-undefined
title: this.props.children undefined
- id: use-react-with-other-libraries
title: Use React with Other Libraries
- id: dangerously-set-inner-html
title: Dangerously Set innerHTML

View File

@@ -0,0 +1,88 @@
- title: Tutorial
items:
- id: tutorial
title: Before We Start
subitems:
- id: what-were-building
title: What We're Building
href: /react/tutorial/tutorial.html#what-were-building
forceInternal: true
- id: prerequisites
title: Prerequisites
href: /react/tutorial/tutorial.html#prerequisites
forceInternal: true
- id: how-to-follow-along
title: How to Follow Along
href: /react/tutorial/tutorial.html#how-to-follow-along
forceInternal: true
- id: help-im-stuck
title: Help, I'm Stuck!
href: /react/tutorial/tutorial.html#help-im-stuck
forceInternal: true
- id: overview
title: Overview
href: /react/tutorial/tutorial.html#overview
forceInternal: true
subitems:
- id: what-is-react
title: What is React?
href: /react/tutorial/tutorial.html#what-is-react
forceInternal: true
- id: getting-started
title: Getting Started
href: /react/tutorial/tutorial.html#getting-started
forceInternal: true
- id: passing-data-through-props
title: Passing Data Through Props
href: /react/tutorial/tutorial.html#passing-data-through-props
forceInternal: true
- id: an-interactive-component
title: An Interactive Component
href: /react/tutorial/tutorial.html#an-interactive-component
forceInternal: true
- id: developer-tools
title: Developer Tools
href: /react/tutorial/tutorial.html#developer-tools
forceInternal: true
- id: lifting-state-up
title: Lifting State Up
href: /react/tutorial/tutorial.html#lifting-state-up
forceInternal: true
subitems:
- id: why-immutability-is-important
title: Why Immutability Is Important
href: /react/tutorial/tutorial.html#why-immutability-is-important
forceInternal: true
- id: functional-components
title: Functional Components
href: /react/tutorial/tutorial.html#functional-components
forceInternal: true
- id: taking-turns
title: Taking Turns
href: /react/tutorial/tutorial.html#taking-turns
forceInternal: true
- id: declaring-a-winner
title: Declaring a Winner
href: /react/tutorial/tutorial.html#declaring-a-winner
forceInternal: true
- id: storing-a-history
title: Storing A History
href: /react/tutorial/tutorial.html#storing-a-history
forceInternal: true
subitems:
- id: showing-the-moves
title: Showing the Moves
href: /react/tutorial/tutorial.html#showing-the-moves
forceInternal: true
- id: keys
title: Keys
href: /react/tutorial/tutorial.html#keys
forceInternal: true
- id: implementing-time-travel
title: Implementing Time Travel
href: /react/tutorial/tutorial.html#implementing-time-travel
forceInternal: true
- id: wrapping-up
title: Wrapping Up
href: /react/tutorial/tutorial.html#wrapping-up
forceInternal: true

Some files were not shown because too many files have changed in this diff Show More