Browse Source

HTTPS-ify most insecure URLs in content/docs (& one in Acknowledgments)

This is a followup to #1157
main
Michał Gołębiowski-Owczarek 6 years ago
parent
commit
7e4ac52af4
  1. 38
      content/docs/accessibility.md
  2. 4
      content/docs/add-react-to-a-website.md
  3. 4
      content/docs/addons-perf.md
  4. 2
      content/docs/addons-shallow-renderer.md
  5. 4
      content/docs/addons-test-utils.md
  6. 4
      content/docs/addons-update.md
  7. 2
      content/docs/code-splitting.md
  8. 4
      content/docs/codebase-overview.md
  9. 6
      content/docs/create-a-new-react-app.md
  10. 6
      content/docs/design-principles.md
  11. 2
      content/docs/faq-functions.md
  12. 2
      content/docs/faq-state.md
  13. 4
      content/docs/getting-started.md
  14. 2
      content/docs/handling-events.md
  15. 4
      content/docs/higher-order-components.md
  16. 4
      content/docs/how-to-contribute.md
  17. 22
      content/docs/integrating-with-other-libraries.md
  18. 6
      content/docs/introducing-jsx.md
  19. 2
      content/docs/reconciliation.md
  20. 2
      content/docs/reference-dom-elements.md
  21. 2
      content/docs/reference-glossary.md
  22. 4
      content/docs/reference-test-renderer.md
  23. 14
      content/docs/state-and-lifecycle.md
  24. 2
      content/docs/static-type-checking.md
  25. 6
      content/docs/thinking-in-react.md
  26. 2
      content/docs/uncontrolled-components.md
  27. 8
      src/pages/acknowledgements.html.js

38
content/docs/accessibility.md

@ -19,8 +19,8 @@ The [Web Content Accessibility Guidelines](https://www.w3.org/WAI/intro/wcag) pr
The following WCAG checklists provide an overview:
- [WCAG checklist from Wuhcag](https://www.wuhcag.com/wcag-checklist/)
- [WCAG checklist from WebAIM](http://webaim.org/standards/wcag/checklist)
- [Checklist from The A11Y Project](http://a11yproject.com/checklist.html)
- [WCAG checklist from WebAIM](https://webaim.org/standards/wcag/checklist)
- [Checklist from The A11Y Project](https://a11yproject.com/checklist.html)
### WAI-ARIA
@ -114,7 +114,7 @@ Every HTML form control, such as `<input>` and `<textarea>`, needs to be labeled
The following resources show us how to do this:
- [The W3C shows us how to label elements](https://www.w3.org/WAI/tutorials/forms/labels/)
- [WebAIM shows us how to label elements](http://webaim.org/techniques/forms/controls)
- [WebAIM shows us how to label elements](https://webaim.org/techniques/forms/controls)
- [The Paciello Group explains accessible names](https://www.paciellogroup.com/blog/2017/04/what-is-an-accessible-name/)
Although these standard HTML practices can be directly used in React, note that the `for` attribute is written as `htmlFor` in JSX:
@ -129,13 +129,13 @@ Although these standard HTML practices can be directly used in React, note that
Error situations need to be understood by all users. The following link shows us how to expose error texts to screen readers as well:
- [The W3C demonstrates user notifications](https://www.w3.org/WAI/tutorials/forms/notifications/)
- [WebAIM looks at form validation](http://webaim.org/techniques/formvalidation/)
- [WebAIM looks at form validation](https://webaim.org/techniques/formvalidation/)
## Focus Control
Ensure that your web application can be fully operated with the keyboard only:
- [WebAIM talks about keyboard accessibility](http://webaim.org/techniques/keyboard/)
- [WebAIM talks about keyboard accessibility](https://webaim.org/techniques/keyboard/)
### Keyboard focus and focus outline
@ -152,13 +152,13 @@ Provide a mechanism to allow users to skip past navigation sections in your appl
Skiplinks or Skip Navigation Links are hidden navigation links that only become visible when keyboard users interact with the page. They are very easy to implement with
internal page anchors and some styling:
- [WebAIM - Skip Navigation Links](http://webaim.org/techniques/skipnav/)
- [WebAIM - Skip Navigation Links](https://webaim.org/techniques/skipnav/)
Also use landmark elements and roles, such as `<main>` and `<aside>`, to demarcate page regions as assistive technology allow the user to quickly navigate to these sections.
Read more about the use of these elements to enhance accessibility here:
- [Accessible Landmarks](http://www.scottohara.me/blog/2018/03/03/landmarks.html)
- [Accessible Landmarks](https://www.scottohara.me/blog/2018/03/03/landmarks.html)
### Programmatically managing focus
@ -387,7 +387,7 @@ These are toolboxes filled with HTML attributes that are fully supported in JSX
Each type of widget has a specific design pattern and is expected to function in a certain way by users and user agents alike:
- [WAI-ARIA Authoring Practices - Design Patterns and Widgets](https://www.w3.org/TR/wai-aria-practices/#aria_ex)
- [Heydon Pickering - ARIA Examples](http://heydonworks.com/practical_aria_examples/)
- [Heydon Pickering - ARIA Examples](https://heydonworks.com/practical_aria_examples/)
- [Inclusive Components](https://inclusive-components.design/)
## Other Points for Consideration
@ -396,7 +396,7 @@ Each type of widget has a specific design pattern and is expected to function in
Indicate the human language of page texts as screen reader software uses this to select the correct voice settings:
- [WebAIM - Document Language](http://webaim.org/techniques/screenreader/#language)
- [WebAIM - Document Language](https://webaim.org/techniques/screenreader/#language)
### Setting the document title
@ -412,15 +412,15 @@ Ensure that all readable text on your website has sufficient color contrast to r
- [WCAG - Understanding the Color Contrast Requirement](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)
- [Everything About Color Contrast And Why You Should Rethink It](https://www.smashingmagazine.com/2014/10/color-contrast-tips-and-tools-for-accessibility/)
- [A11yProject - What is Color Contrast](http://a11yproject.com/posts/what-is-color-contrast/)
- [A11yProject - What is Color Contrast](https://a11yproject.com/posts/what-is-color-contrast/)
It can be tedious to manually calculate the proper color combinations for all cases in your website so instead, you can [calculate an entire accessible color palette with Colorable](http://jxnblk.com/colorable/).
It can be tedious to manually calculate the proper color combinations for all cases in your website so instead, you can [calculate an entire accessible color palette with Colorable](https://jxnblk.com/colorable/).
Both the aXe and WAVE tools mentioned below also include color contrast tests and will report on contrast errors.
If you want to extend your contrast testing abilities you can use these tools:
- [WebAIM - Color Contrast Checker](http://webaim.org/resources/contrastchecker/)
- [WebAIM - Color Contrast Checker](https://webaim.org/resources/contrastchecker/)
- [The Paciello Group - Color Contrast Analyzer](https://www.paciellogroup.com/resources/contrastanalyser/)
## Development and Testing Tools
@ -471,7 +471,7 @@ You can also use the [react-axe](https://github.com/dylanb/react-axe) module to
#### WebAIM WAVE
The [Web Accessibility Evaluation Tool](http://wave.webaim.org/extension/) is another accessibility browser extension.
The [Web Accessibility Evaluation Tool](https://wave.webaim.org/extension/) is another accessibility browser extension.
#### Accessibility inspectors and the Accessibility Tree
@ -498,7 +498,7 @@ Please note that browser / screen reader combinations matter. It is recommended
Refer to the following guides on how to best use NVDA:
- [WebAIM - Using NVDA to Evaluate Web Accessibility](http://webaim.org/articles/nvda/)
- [WebAIM - Using NVDA to Evaluate Web Accessibility](https://webaim.org/articles/nvda/)
- [Deque - NVDA Keyboard Shortcuts](https://dequeuniversity.com/screenreaders/nvda-keyboard-shortcuts)
#### VoiceOver in Safari
@ -507,26 +507,26 @@ VoiceOver is an integrated screen reader on Apple devices.
Refer to the following guides on how activate and use VoiceOver:
- [WebAIM - Using VoiceOver to Evaluate Web Accessibility](http://webaim.org/articles/voiceover/)
- [WebAIM - Using VoiceOver to Evaluate Web Accessibility](https://webaim.org/articles/voiceover/)
- [Deque - VoiceOver for OS X Keyboard Shortcuts](https://dequeuniversity.com/screenreaders/voiceover-keyboard-shortcuts)
- [Deque - VoiceOver for iOS Shortcuts](https://dequeuniversity.com/screenreaders/voiceover-ios-shortcuts)
#### JAWS in Internet Explorer
[Job Access With Speech](http://www.freedomscientific.com/Products/Blindness/JAWS) or JAWS, is a prolifically used screen reader on Windows.
[Job Access With Speech](https://www.freedomscientific.com/Products/software/JAWS/) or JAWS, is a prolifically used screen reader on Windows.
Refer to the following guides on how to best use JAWS:
- [WebAIM - Using JAWS to Evaluate Web Accessibility](http://webaim.org/articles/jaws/)
- [WebAIM - Using JAWS to Evaluate Web Accessibility](https://webaim.org/articles/jaws/)
- [Deque - JAWS Keyboard Shortcuts](https://dequeuniversity.com/screenreaders/jaws-keyboard-shortcuts)
### Other Screen Readers
#### ChromeVox in Google Chrome
[ChromeVox](http://www.chromevox.com/) is an integrated screen reader on Chromebooks and is available [as an extension](https://chrome.google.com/webstore/detail/chromevox/kgejglhpjiefppelpmljglcjbhoiplfn?hl=en) for Google Chrome.
[ChromeVox](https://www.chromevox.com/) is an integrated screen reader on Chromebooks and is available [as an extension](https://chrome.google.com/webstore/detail/chromevox/kgejglhpjiefppelpmljglcjbhoiplfn?hl=en) for Google Chrome.
Refer to the following guides on how best to use ChromeVox:
- [Google Chromebook Help - Use the Built-in Screen Reader](https://support.google.com/chromebook/answer/7031755?hl=en)
- [ChromeVox Classic Keyboard Shortcuts Reference](http://www.chromevox.com/keyboard_shortcuts.html)
- [ChromeVox Classic Keyboard Shortcuts Reference](https://www.chromevox.com/keyboard_shortcuts.html)

4
content/docs/add-react-to-a-website.md

@ -149,7 +149,7 @@ return (
These two code snippets are equivalent. While **JSX is [completely optional](/docs/react-without-jsx.html)**, many people find it helpful for writing UI code -- both with React and with other libraries.
You can play with JSX using [this online converter](http://babeljs.io/repl#?babili=false&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=Q&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&sourceType=module&lineWrap=true&presets=es2015%2Creact%2Cstage-2%2Cstage-3&prettier=true&targets=Node-6.12&version=6.26.0&envVersion=).
You can play with JSX using [this online converter](https://babeljs.io/repl#?babili=false&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=Q&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&sourceType=module&lineWrap=true&presets=es2015%2Creact%2Cstage-2%2Cstage-3&prettier=true&targets=Node-6.12&version=6.26.0&envVersion=).
### Quickly Try JSX
@ -197,6 +197,6 @@ Don't wait for it to finish -- this command starts an automated watcher for JSX.
If you now create a file called `src/like_button.js` with this **[JSX starter code](https://cdn.rawgit.com/gaearon/c8e112dc74ac44aac4f673f2c39d19d1/raw/09b951c86c1bf1116af741fa4664511f2f179f0a/like_button.js)**, the watcher will create a preprocessed `like_button.js` with the plain JavaScript code suitable for the browser. When you edit the source file with JSX, the transform will re-run automatically.
As a bonus, this also lets you use modern JavaScript syntax features like classes without worrying about breaking older browsers. The tool we just used is called Babel, and you can learn more about it from [its documentation](http://babeljs.io/docs/en/babel-cli/).
As a bonus, this also lets you use modern JavaScript syntax features like classes without worrying about breaking older browsers. The tool we just used is called Babel, and you can learn more about it from [its documentation](https://babeljs.io/docs/en/babel-cli/).
If you notice that you're getting comfortable with build tools and want them to do more for you, [the next section](/docs/create-a-new-react-app.html) describes some of the most popular and approachable toolchains. If not -- those script tags will do just fine!

4
content/docs/addons-perf.md

@ -27,8 +27,8 @@ In addition to giving you an overview of your app's overall performance, `Perf`
See these articles for an introduction to React performance tooling:
- ["How to Benchmark React Components"](https://medium.com/code-life/how-to-benchmark-react-components-the-quick-and-dirty-guide-f595baf1014c)
- ["Performance Engineering with React"](http://benchling.engineering/performance-engineering-with-react/)
- ["A Deep Dive into React Perf Debugging"](http://benchling.engineering/deep-dive-react-perf-debugging/)
- ["Performance Engineering with React"](https://benchling.engineering/performance-engineering-with-react/)
- ["A Deep Dive into React Perf Debugging"](https://benchling.engineering/deep-dive-react-perf-debugging/)
### Development vs. Production Builds

2
content/docs/addons-shallow-renderer.md

@ -51,7 +51,7 @@ Shallow testing currently has some limitations, namely not supporting refs.
> Note:
>
> We also recommend checking out Enzyme's [Shallow Rendering API](http://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality.
> We also recommend checking out Enzyme's [Shallow Rendering API](https://airbnb.io/enzyme/docs/api/shallow.html). It provides a nicer higher-level API over the same functionality.
## Reference

4
content/docs/addons-test-utils.md

@ -15,13 +15,13 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
## Overview
`ReactTestUtils` makes it easy to test React components in the testing framework of your choice. At Facebook we use [Jest](https://facebook.github.io/jest/) for painless JavaScript testing. Learn how to get started with Jest through the Jest website's [React Tutorial](http://facebook.github.io/jest/docs/en/tutorial-react.html#content).
`ReactTestUtils` makes it easy to test React components in the testing framework of your choice. At Facebook we use [Jest](https://facebook.github.io/jest/) for painless JavaScript testing. Learn how to get started with Jest through the Jest website's [React Tutorial](https://jestjs.io/docs/tutorial-react).
> Note:
>
> We recommend using [`react-testing-library`](https://git.io/react-testing-library) which is designed to enable and encourage writing tests that use your components as the end users do.
>
> Alternatively, Airbnb has released a testing utility called [Enzyme](http://airbnb.io/enzyme/), which makes it easy to assert, manipulate, and traverse your React Components' output.
> Alternatively, Airbnb has released a testing utility called [Enzyme](https://airbnb.io/enzyme/), which makes it easy to assert, manipulate, and traverse your React Components' output.
- [`act()`](#act)
- [`mockComponent()`](#mockcomponent)

4
content/docs/addons-update.md

@ -21,7 +21,7 @@ var update = require('react-addons-update'); // ES5 with npm
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()`](/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 [Advanced Performance](/docs/advanced-performance.html) section for more detail on Immutable-js.
Dealing with immutable data in JavaScript is more difficult than in languages designed for it, like [Clojure](https://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 [Advanced Performance](/docs/advanced-performance.html) section for more detail on Immutable-js.
### The Main Idea
@ -67,7 +67,7 @@ const newData = update(myData, {
});
```
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.
While the syntax takes a little getting used to (though it's inspired by [MongoDB's query language](https://docs.mongodb.com/manual/crud/#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*.

2
content/docs/code-splitting.md

@ -108,7 +108,7 @@ out of the box in [Next.js](https://github.com/zeit/next.js/#dynamic-import).
If you're setting up Webpack yourself, you'll probably want to read Webpack's
[guide on code splitting](https://webpack.js.org/guides/code-splitting/). Your Webpack config should look vaguely [like this](https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269).
When using [Babel](http://babeljs.io/), you'll need to make sure that Babel can
When using [Babel](https://babeljs.io/), you'll need to make sure that Babel can
parse the dynamic import syntax but is not transforming it. For that you will need [babel-plugin-syntax-dynamic-import](https://yarnpkg.com/en/package/babel-plugin-syntax-dynamic-import).
## `React.lazy`

4
content/docs/codebase-overview.md

@ -155,7 +155,7 @@ There are multiple injection points in the codebase. In the future, we intend to
### Multiple Packages
React is a [monorepo](http://danluu.com/monorepo/). Its repository contains multiple separate packages so that their changes can be coordinated together, and issues live in one place.
React is a [monorepo](https://danluu.com/monorepo/). Its repository contains multiple separate packages so that their changes can be coordinated together, and issues live in one place.
### React Core
@ -171,7 +171,7 @@ The code for React core is located in [`packages/react`](https://github.com/face
### Renderers
React was originally created for the DOM but it was later adapted to also support native platforms with [React Native](http://facebook.github.io/react-native/). This introduced the concept of "renderers" to React internals.
React was originally created for the DOM but it was later adapted to also support native platforms with [React Native](https://facebook.github.io/react-native/). This introduced the concept of "renderers" to React internals.
**Renderers manage how a React tree turns into the underlying platform calls.**

6
content/docs/create-a-new-react-app.md

@ -37,7 +37,7 @@ The React team primarily recommends these solutions:
### Create React App
[Create React App](http://github.com/facebookincubator/create-react-app) is a comfortable environment for **learning React**, and is the best way to start building **a new [single-page](/docs/glossary.html#single-page-application) application** in React.
[Create React App](https://github.com/facebookincubator/create-react-app) is a comfortable environment for **learning React**, and is the best way to start building **a new [single-page](/docs/glossary.html#single-page-application) application** in React.
It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production. You’ll need to have Node >= 6 and npm >= 5.2 on your machine. To create a project, run:
@ -51,7 +51,7 @@ npm start
>
>`npx` on the first line is not a typo -- it's a [package runner tool that comes with npm 5.2+](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b).
Create React App doesn't handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want. Under the hood, it uses [Babel](http://babeljs.io/) and [webpack](https://webpack.js.org/), but you don't need to know anything about them.
Create React App doesn't handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want. Under the hood, it uses [Babel](https://babeljs.io/) and [webpack](https://webpack.js.org/), but you don't need to know anything about them.
When you're ready to deploy to production, running `npm run build` will create an optimized build of your app in the `build` folder. You can learn more about Create React App [from its README](https://github.com/facebookincubator/create-react-app#create-react-app-) and the [User Guide](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#table-of-contents).
@ -87,7 +87,7 @@ A JavaScript build toolchain typically consists of:
* A **bundler**, such as [webpack](https://webpack.js.org/) or [Parcel](https://parceljs.org/). It lets you write modular code and bundle it together into small packages to optimize load time.
* A **compiler** such as [Babel](http://babeljs.io/). It lets you write modern JavaScript code that still works in older browsers.
* A **compiler** such as [Babel](https://babeljs.io/). It lets you write modern JavaScript code that still works in older browsers.
If you prefer to set up your own JavaScript toolchain from scratch, [check out this guide](https://blog.usejournal.com/creating-a-react-app-from-scratch-f3c693b84658) that re-creates some of the Create React App functionality.

6
content/docs/design-principles.md

@ -24,7 +24,7 @@ For example, it should be possible to introduce some local state into a componen
There is nothing "bad" about using state or lifecycle methods in components. Like any powerful feature, they should be used in moderation, but we have no intention to remove them. On the contrary, we think they are integral parts of what makes React useful. We might enable [more functional patterns](https://github.com/reactjs/react-future/tree/master/07%20-%20Returning%20State) in the future, but both local state and lifecycle methods will be a part of that model.
Components are often described as "just functions" but in our view they need to be more than that to be useful. In React, components describe any composable behavior, and this includes rendering, lifecycle, and state. Some external libraries like [Relay](http://facebook.github.io/relay/) augment components with other responsibilities such as describing data dependencies. It is possible that those ideas might make it back into React too in some form.
Components are often described as "just functions" but in our view they need to be more than that to be useful. In React, components describe any composable behavior, and this includes rendering, lifecycle, and state. Some external libraries like [Relay](https://facebook.github.io/relay/) augment components with other responsibilities such as describing data dependencies. It is possible that those ideas might make it back into React too in some form.
### Common Abstraction
@ -126,7 +126,7 @@ We do, however, provide some global configuration on the build level. For exampl
### Beyond the DOM
We see the value of React in the way it allows us to write components that have fewer bugs and compose together well. DOM is the original rendering target for React but [React Native](http://facebook.github.io/react-native/) is just as important both to Facebook and the community.
We see the value of React in the way it allows us to write components that have fewer bugs and compose together well. DOM is the original rendering target for React but [React Native](https://facebook.github.io/react-native/) is just as important both to Facebook and the community.
Being renderer-agnostic is an important design constraint of React. It adds some overhead in the internal representations. On the other hand, any improvements to the core translate across platforms.
@ -148,7 +148,7 @@ Optimizing for search is also important because of our reliance on [codemods](ht
[JSX](/docs/introducing-jsx.html) plays a similar role. While it is not required with React, we use it extensively at Facebook both for aesthetic and pragmatic reasons.
In our codebase, JSX provides an unambiguous hint to the tools that they are dealing with a React element tree. This makes it possible to add build-time optimizations such as [hoisting constant elements](http://babeljs.io/docs/plugins/transform-react-constant-elements/), safely lint and codemod internal component usage, and [include JSX source location](https://github.com/facebook/react/pull/6771) into the warnings.
In our codebase, JSX provides an unambiguous hint to the tools that they are dealing with a React element tree. This makes it possible to add build-time optimizations such as [hoisting constant elements](https://babeljs.io/docs/en/babel-plugin-transform-react-constant-elements/), safely lint and codemod internal component usage, and [include JSX source location](https://github.com/facebook/react/pull/6771) into the warnings.
### Dogfooding

2
content/docs/faq-functions.md

@ -108,7 +108,7 @@ Binding methods helps ensure that the second snippet works the same way as the f
With React, typically you only need to bind the methods you *pass* to other components. For example, `<button onClick={this.handleClick}>` passes `this.handleClick` so you want to bind it. However, it is unnecessary to bind the `render` method or the lifecycle methods: we don't pass them to other components.
[This post by Yehuda Katz](http://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/) explains what binding is, and how functions work in JavaScript, in detail.
[This post by Yehuda Katz](https://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/) explains what binding is, and how functions work in JavaScript, in detail.
### Why is my function being called every time the component renders?

2
content/docs/faq-state.md

@ -16,7 +16,7 @@ category: FAQ
Here are some good resources for further reading on when to use `props` vs `state`:
* [Props vs State](https://github.com/uberVU/react-guide/blob/master/props-vs-state.md)
* [ReactJS: Props vs. State](http://lucybain.com/blog/2016/react-state-vs-pros/)
* [ReactJS: Props vs. State](https://lucybain.com/blog/2016/react-state-vs-pros/)
### Why is `setState` giving me the wrong value?

4
content/docs/getting-started.md

@ -69,7 +69,7 @@ If you feel that the React documentation goes at a faster pace than you're comfo
### React for Designers
If you're coming from a design background, [these resources](http://reactfordesigners.com/) are a great place to get started.
If you're coming from a design background, [these resources](https://reactfordesigners.com/) are a great place to get started.
### JavaScript Resources
@ -79,7 +79,7 @@ We recommend going through [this JavaScript overview](https://developer.mozilla.
>Tip
>
>Whenever you get confused by something in JavaScript, [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript) and [javascript.info](http://javascript.info/) are great websites to check. There are also [community support forums](/community/support.html) where you can ask for help.
>Whenever you get confused by something in JavaScript, [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript) and [javascript.info](https://javascript.info/) are great websites to check. There are also [community support forums](/community/support.html) where you can ask for help.
### Practical Tutorial

2
content/docs/handling-events.md

@ -91,7 +91,7 @@ ReactDOM.render(
);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/xEmzGg?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/xEmzGg?editors=0010)
You have to be careful about the meaning of `this` in JSX callbacks. In JavaScript, class methods are not [bound](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind) by default. If you forget to bind `this.handleClick` and pass it to `onClick`, `this` will be `undefined` when the function is actually called.

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

@ -14,7 +14,7 @@ const EnhancedComponent = higherOrderComponent(WrappedComponent);
Whereas a component transforms props into UI, a higher-order component transforms a component into another component.
HOCs are common in third-party React libraries, such as Redux's [`connect`](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options) and Relay's [`createFragmentContainer`](http://facebook.github.io/relay/docs/en/fragment-container.html).
HOCs are common in third-party React libraries, such as Redux's [`connect`](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options) and Relay's [`createFragmentContainer`](https://facebook.github.io/relay/docs/en/fragment-container.html).
In this document, we'll discuss why higher-order components are useful, and how to write your own.
@ -293,7 +293,7 @@ const EnhancedComponent = enhance(WrappedComponent)
(This same property also allows `connect` and other enhancer-style HOCs to be used as decorators, an experimental JavaScript proposal.)
The `compose` utility function is provided by many third-party libraries including lodash (as [`lodash.flowRight`](https://lodash.com/docs/#flowRight)), [Redux](http://redux.js.org/docs/api/compose.html), and [Ramda](http://ramdajs.com/docs/#compose).
The `compose` utility function is provided by many third-party libraries including lodash (as [`lodash.flowRight`](https://lodash.com/docs/#flowRight)), [Redux](https://redux.js.org/api/compose), and [Ramda](https://ramdajs.com/docs/#compose).
## Convention: Wrap the Display Name for Easy Debugging

4
content/docs/how-to-contribute.md

@ -27,7 +27,7 @@ If you send a pull request, please do it against the `master` branch. We maintai
### Semantic Versioning
React follows [semantic versioning](http://semver.org/). We release patch versions for bugfixes, minor versions for new features, and major versions for any breaking changes. When we make breaking changes, we also introduce deprecation warnings in a minor version so that our users learn about the upcoming changes and migrate their code in advance.
React follows [semantic versioning](https://semver.org/). We release patch versions for bugfixes, minor versions for new features, and major versions for any breaking changes. When we make breaking changes, we also introduce deprecation warnings in a minor version so that our users learn about the upcoming changes and migrate their code in advance.
We tag every pull request with a label marking whether the change should go in the next [patch](https://github.com/facebook/react/pulls?q=is:open+is:pr+label:semver-patch), [minor](https://github.com/facebook/react/pulls?q=is:open+is:pr+label:semver-minor), or a [major](https://github.com/facebook/react/pulls?q=is:open+is:pr+label:semver-major) version. We release new patch versions every few weeks, minor versions every few months, and major versions one or two times a year.
@ -52,7 +52,7 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
* IRC: [#reactjs on freenode](https://webchat.freenode.net/?channels=reactjs)
* Discussion forum: [discuss.reactjs.org](https://discuss.reactjs.org/)
There is also [an active community of React users on the Discord chat platform](http://www.reactiflux.com/) in case you need help with React.
There is also [an active community of React users on the Discord chat platform](https://www.reactiflux.com/) in case you need help with React.
### Proposing a Change

22
content/docs/integrating-with-other-libraries.md

@ -4,7 +4,7 @@ title: Integrating with Other Libraries
permalink: docs/integrating-with-other-libraries.html
---
React can be used in any web application. It can be embedded in other applications and, with a little care, other applications can be embedded in React. This guide will examine some of the more common use cases, focusing on integration with [jQuery](https://jquery.com/) and [Backbone](http://backbonejs.org/), but the same ideas can be applied to integrating components with any existing code.
React can be used in any web application. It can be embedded in other applications and, with a little care, other applications can be embedded in React. This guide will examine some of the more common use cases, focusing on integration with [jQuery](https://jquery.com/) and [Backbone](https://backbonejs.org/), but the same ideas can be applied to integrating components with any existing code.
## Integrating with DOM Manipulation Plugins
@ -100,7 +100,7 @@ componentWillUnmount() {
}
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/qmqeQx?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/qmqeQx?editors=0010)
Note that React assigns no special meaning to the `this.el` field. It only works because we have previously assigned this field from a `ref` in the `render()` method:
@ -131,7 +131,7 @@ handleChange(e) {
}
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/bWgbeE?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/bWgbeE?editors=0010)
Finally, there is one more thing left to do. In React, props can change over time. For example, the `<Chosen>` component can get different children if parent component's state changes. This means that at integration points it is important that we manually update the DOM in response to prop updates, since we no longer let React manage the DOM for us.
@ -186,7 +186,7 @@ class Chosen extends React.Component {
}
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/xdgKOz?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/xdgKOz?editors=0010)
## Integrating with Other View Libraries
@ -247,13 +247,13 @@ ReactDOM.render(
);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/RVKbvW?editors=1010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/RVKbvW?editors=1010)
You can have as many such isolated components as you like, and use `ReactDOM.render()` to render them to different DOM containers. Gradually, as you convert more of your app to React, you will be able to combine them into larger components, and move some of the `ReactDOM.render()` calls up the hierarchy.
### Embedding React in a Backbone View
[Backbone](http://backbonejs.org/) views typically use HTML strings, or string-producing template functions, to create the content for their DOM elements. This process, too, can be replaced with rendering a React component.
[Backbone](https://backbonejs.org/) views typically use HTML strings, or string-producing template functions, to create the content for their DOM elements. This process, too, can be replaced with rendering a React component.
Below, we will create a Backbone view called `ParagraphView`. It will override Backbone's `render()` function to render a React `<Paragraph>` component into the DOM element provided by Backbone (`this.el`). Here, too, we are using [`ReactDOM.render()`](/docs/react-dom.html#render):
@ -275,7 +275,7 @@ const ParagraphView = Backbone.View.extend({
});
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/gWgOYL?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/gWgOYL?editors=0010)
It is important that we also call `ReactDOM.unmountComponentAtNode()` in the `remove` method so that React unregisters event handlers and other resources associated with the component tree when it is detached.
@ -283,11 +283,11 @@ When a component is removed *from within* a React tree, the cleanup is performed
## Integrating with Model Layers
While it is generally recommended to use unidirectional data flow such as [React state](/docs/lifting-state-up.html), [Flux](http://facebook.github.io/flux/), or [Redux](http://redux.js.org/), React components can use a model layer from other frameworks and libraries.
While it is generally recommended to use unidirectional data flow such as [React state](/docs/lifting-state-up.html), [Flux](https://facebook.github.io/flux/), or [Redux](https://redux.js.org/), React components can use a model layer from other frameworks and libraries.
### Using Backbone Models in React Components
The simplest way to consume [Backbone](http://backbonejs.org/) models and collections from a React component is to listen to the various change events and manually force an update.
The simplest way to consume [Backbone](https://backbonejs.org/) models and collections from a React component is to listen to the various change events and manually force an update.
Components responsible for rendering models would listen to `'change'` events, while components responsible for rendering collections would listen for `'add'` and `'remove'` events. In both cases, call [`this.forceUpdate()`](/docs/react-component.html#forceupdate) to rerender the component with the new data.
@ -347,7 +347,7 @@ class List extends React.Component {
}
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/GmrREm?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/GmrREm?editors=0010)
### Extracting Data from Backbone Models
@ -434,6 +434,6 @@ ReactDOM.render(
);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/PmWwwa?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/PmWwwa?editors=0010)
This technique is not limited to Backbone. You can use React with any model library by subscribing to its changes in the lifecycle methods and, optionally, copying the data into the local React state.

6
content/docs/introducing-jsx.md

@ -70,7 +70,7 @@ ReactDOM.render(
[](codepen://introducing-jsx)
We split JSX over multiple lines for readability. While it isn't required, when doing this, we also recommend wrapping it in parentheses to avoid the pitfalls of [automatic semicolon insertion](http://stackoverflow.com/q/2846283).
We split JSX over multiple lines for readability. While it isn't required, when doing this, we also recommend wrapping it in parentheses to avoid the pitfalls of [automatic semicolon insertion](https://stackoverflow.com/q/2846283).
### JSX is an Expression Too
@ -138,7 +138,7 @@ const title = response.potentiallyMaliciousInput;
const element = <h1>{title}</h1>;
```
By default, React DOM [escapes](http://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-on-html) any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that's not explicitly written in your application. Everything is converted to a string before being rendered. This helps prevent [XSS (cross-site-scripting)](https://en.wikipedia.org/wiki/Cross-site_scripting) attacks.
By default, React DOM [escapes](https://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-on-html) any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that's not explicitly written in your application. Everything is converted to a string before being rendered. This helps prevent [XSS (cross-site-scripting)](https://en.wikipedia.org/wiki/Cross-site_scripting) attacks.
### JSX Represents Objects
@ -181,4 +181,4 @@ We will explore rendering React elements to the DOM in the next section.
>**Tip:**
>
>We recommend using the ["Babel" language definition](http://babeljs.io/docs/editors) for your editor of choice so that both ES6 and JSX code is properly highlighted. This website uses the [Oceanic Next](https://labs.voronianski.com/oceanic-next-color-scheme/) color scheme which is compatible with it.
>We recommend using the ["Babel" language definition](https://babeljs.io/docs/editors) for your editor of choice so that both ES6 and JSX code is properly highlighted. This website uses the [Oceanic Next](https://labs.voronianski.com/oceanic-next-color-scheme/) color scheme which is compatible with it.

2
content/docs/reconciliation.md

@ -10,7 +10,7 @@ React provides a declarative API so that you don't have to worry about exactly w
When you use React, at a single point in time you can think of the `render()` function as creating a tree of React elements. On the next state or props update, that `render()` function will return a different tree of React elements. React then needs to figure out how to efficiently update the UI to match the most recent tree.
There are some generic solutions to this algorithmic problem of generating the minimum number of operations to transform one tree into another. However, the [state of the art algorithms](http://grfia.dlsi.ua.es/ml/algorithms/references/editsurvey_bille.pdf) have a complexity in the order of O(n<sup>3</sup>) where n is the number of elements in the tree.
There are some generic solutions to this algorithmic problem of generating the minimum number of operations to transform one tree into another. However, the [state of the art algorithms](https://grfia.dlsi.ua.es/ml/algorithms/references/editsurvey_bille.pdf) have a complexity in the order of O(n<sup>3</sup>) where n is the number of elements in the tree.
If we used this in React, displaying 1000 elements would require in the order of one billion comparisons. This is far too expensive. Instead, React implements a heuristic O(n) algorithm based on two assumptions:

2
content/docs/reference-dom-elements.md

@ -90,7 +90,7 @@ function ComponentWithTransition() {
}
```
Style keys are camelCased in order to be consistent with accessing the properties on DOM nodes from JS (e.g. `node.style.backgroundImage`). Vendor prefixes [other than `ms`](http://www.andismith.com/blog/2012/02/modernizr-prefixed/) should begin with a capital letter. This is why `WebkitTransition` has an uppercase "W".
Style keys are camelCased in order to be consistent with accessing the properties on DOM nodes from JS (e.g. `node.style.backgroundImage`). Vendor prefixes [other than `ms`](https://www.andismith.com/blogs/2012/02/modernizr-prefixed/) should begin with a capital letter. This is why `WebkitTransition` has an uppercase "W".
React will automatically append a "px" suffix to certain numeric inline style properties. If you want to use units other than "px", specify the value as a string with the desired unit. For example:

2
content/docs/reference-glossary.md

@ -27,7 +27,7 @@ Bundlers take JavaScript and CSS code written as separate modules (often hundred
## Package Managers
Package managers are tools that allow you to manage dependencies in your project. [npm](https://www.npmjs.com/) and [Yarn](http://yarnpkg.com/) are two package managers commonly used in React applications. Both of them are clients for the same npm package registry.
Package managers are tools that allow you to manage dependencies in your project. [npm](https://www.npmjs.com/) and [Yarn](https://yarnpkg.com/) are two package managers commonly used in React applications. Both of them are clients for the same npm package registry.
## CDN

4
content/docs/reference-test-renderer.md

@ -38,7 +38,7 @@ console.log(testRenderer.toJSON());
// children: [ 'Facebook' ] }
```
You can use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: [Learn more about it](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html).
You can use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: [Learn more about it](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html).
You can also traverse the output to find specific nodes and make assertions about them.
@ -110,7 +110,7 @@ Create a `TestRenderer` instance with the passed React element. It doesn't use t
testRenderer.toJSON()
```
Return an object representing the rendered tree. This tree only contains the platform-specific nodes like `<div>` or `<View>` and their props, but doesn't contain any user-written components. This is handy for [snapshot testing](http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest).
Return an object representing the rendered tree. This tree only contains the platform-specific nodes like `<div>` or `<View>` and their props, but doesn't contain any user-written components. This is handy for [snapshot testing](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest).
### `testRenderer.toTree()`

14
content/docs/state-and-lifecycle.md

@ -29,7 +29,7 @@ function tick() {
setInterval(tick, 1000);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/gwoJZk?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/gwoJZk?editors=0010)
In this section, we will learn how to make the `Clock` component truly reusable and encapsulated. It will set up its own timer and update itself every second.
@ -55,7 +55,7 @@ function tick() {
setInterval(tick, 1000);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/dpdoYR?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/dpdoYR?editors=0010)
However, it misses a crucial requirement: the fact that the `Clock` sets up a timer and updates the UI every second should be an implementation detail of the `Clock`.
@ -101,7 +101,7 @@ class Clock extends React.Component {
}
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/zKRGpo?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/zKRGpo?editors=0010)
`Clock` is now defined as a class rather than a function.
@ -193,7 +193,7 @@ ReactDOM.render(
);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/KgQpJd?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/KgQpJd?editors=0010)
Next, we'll make the `Clock` set up its own timer and update itself every second.
@ -302,7 +302,7 @@ ReactDOM.render(
);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/amqdNA?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/amqdNA?editors=0010)
Now the clock ticks every second.
@ -437,7 +437,7 @@ function FormattedDate(props) {
}
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/zKRqNB?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/zKRqNB?editors=0010)
This is commonly called a "top-down" or "unidirectional" data flow. Any state is always owned by some specific component, and any data or UI derived from that state can only affect components "below" them in the tree.
@ -462,7 +462,7 @@ ReactDOM.render(
);
```
[**Try it on CodePen**](http://codepen.io/gaearon/pen/vXdGmd?editors=0010)
[**Try it on CodePen**](https://codepen.io/gaearon/pen/vXdGmd?editors=0010)
Each `Clock` sets up its own timer and updates independently.

2
content/docs/static-type-checking.md

@ -324,4 +324,4 @@ JetBrains develops and maintains several tools specifically for the React commun
## Other Languages
Note there are other statically typed languages that compile to JavaScript and are thus React compatible. For example, [F#/Fable](http://fable.io) with [elmish-react](https://elmish.github.io/react). Check out their respective sites for more information, and feel free to add more statically typed languages that work with React to this page!
Note there are other statically typed languages that compile to JavaScript and are thus React compatible. For example, [F#/Fable](https://fable.io/) with [elmish-react](https://elmish.github.io/react). Check out their respective sites for more information, and feel free to add more statically typed languages that work with React to this page!

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

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

2
content/docs/uncontrolled-components.md

@ -41,7 +41,7 @@ class NameForm extends React.Component {
Since an uncontrolled component keeps the source of truth in the DOM, it is sometimes easier to integrate React and non-React code when using uncontrolled components. It can also be slightly less code if you want to be quick and dirty. Otherwise, you should usually use controlled components.
If it's still not clear which type of component you should use for a particular situation, you might find [this article on controlled versus uncontrolled inputs](http://goshakkk.name/controlled-vs-uncontrolled-inputs-react/) to be helpful.
If it's still not clear which type of component you should use for a particular situation, you might find [this article on controlled versus uncontrolled inputs](https://goshakkk.name/controlled-vs-uncontrolled-inputs-react/) to be helpful.
### Default Values

8
src/pages/acknowledgements.html.js

@ -54,10 +54,10 @@ const Acknowlegements = ({data, location}) => (
</li>
<li>
<a href="https://christopheraue.net/">Christopher Aue</a> for
letting us use the <a href="http://reactjs.com/">reactjs.com</a>{' '}
domain name and the{' '}
<a href="https://twitter.com/reactjs">@reactjs</a> username on
Twitter.
letting us use the{' '}
<a href="https://reactjs.com/">reactjs.com</a> domain name and
the <a href="https://twitter.com/reactjs">@reactjs</a> username
on Twitter.
</li>
<li>
<a href="https://github.com/ProjectMoon">ProjectMoon</a> for

Loading…
Cancel
Save