Commit Graph

119 Commits

Author SHA1 Message Date
Nathan Quarles
392d5bfdcd Update lifecycles.js (#1098)
`theme ? 'dark' : 'light'` will always use the dark theme no matter what it's set to in context. Guessing this is not what was intended? This PR fixes it.
2018-07-27 13:32:12 -07:00
Dan
3d38ca4724 Fix CI 2018-06-23 01:42:26 +01:00
Rodrigo Bermúdez Schettino
24f0448d7c Update Ref API in docs (#970)
* Update Ref API in docs

Update to new React.createRef() API in guide "Uncontrolled Components".

* Update Ref API in doc example

Use new Ref API in guide's example.

* Fix syntax error in example

* Update highlighting ranges in docs

After updating to the new createRef API, the highlighting ranges in Uncontrolled Components were wrong.

* Update highlighting ranges in docs example

After updating to the new createRef API, the highlighting ranges in Uncontrolled Components were wrong.

* Update highlighting ranges in docs example

Remove empty line in source code.

* Update uncontrolled-components.md

* Update input-type-file.js
2018-06-22 12:08:03 +01:00
Brian Vaughn
3e80980c18 Renamed params for gDSFP 2018-05-24 18:18:04 -07:00
Andrew Clark
30be0d05fa Add back pointer events example 2018-05-23 17:55:32 -07:00
Andrew Clark
55b251146d Add pointer events example 2018-05-23 16:44:44 -07:00
Travis Arnold
fc99015393 swap example theme colors (#851) 2018-04-29 16:23:25 -07:00
Brian Vaughn
cad9c0e424 Prettier 2018-04-18 09:59:41 -07:00
Dan Abramov
e32847f030 Add a defaultValue for context example 2018-04-18 17:23:12 +01:00
Lucas Duailibe
dab9b8b2fd Add 'visual components' use case for forwarding refs (#798)
* Add 'visual components' use case for forwarding refs

* Rearrange "forwarding refs" to focus on simple use case

* Minor wording nits to 2018-03-29-react-v-16-3.md

* Minor wording nits to forwarding-refs.md

* Add more info to the forwardRef reference doc

* Minor wording nits to reference-react.md
2018-04-13 17:23:19 +01:00
Brian Vaughn
7351d11a89 Fixed invalid getSnapshotBeforeUpdate() example code (#799)
* Fixed invalid getSnapshotBeforeUpdate() example code

* Don't use class properties in stable docs
2018-04-13 14:41:27 +01:00
Brian Vaughn
d453c2c8fb Merge pull request #767 from koba04/customizing-display-name-ref-forwarding
Add a section "Customizing Name in DevTools" in Forwarding Refs
2018-04-11 08:17:28 -07:00
Toru Kobayashi
f450adbdec Add a section "Displaying a custom name in DevTools" 2018-04-11 11:56:17 +09:00
Dan Abramov
7ab54e2928 Remove too much highlighting in a small snippet 2018-04-09 19:26:30 +01:00
tjallingt
6521a654cb Added updating nested context default value example (#780)
* added context default value example

* Implement suggested change

* noop function as default value to createContext
2018-04-09 11:12:02 -07:00
Brian Vaughn
5ba8e04f26 Merge pull request #748 from tgallacher/fix/blog-react-v-16-3
Fix: added missing component instantiation within the 'forwardRef' AP…
2018-04-08 11:15:57 -07:00
tjallingt
e4941f6440 Added example for updating nested context consumer (#776)
* Added an example showing how to update the context from inside a (deeply) nested component

* Wrap comments

* Wrap comments

* Tweak wording

* Prettier

* Prettier

* Typo: "funtion" -> "function"
2018-04-06 18:49:55 -07:00
Brian Vaughn
c4bf6b087a Merge pull request #764 from bvaughn/react-lifecycles-compat-v2
Updated react-lifecycles-compat example to show 2.0 named export
2018-04-04 19:58:01 -07:00
Dan Abramov
f7cf140607 Tweak context docs (#766) 2018-04-04 15:21:16 +01:00
Brian Vaughn
ec718a33ee Updated react-lifecycles-compat example to show 2.0 named export 2018-04-03 10:33:37 -07:00
Brian Vaughn
4a2a8541cb Merge pull request #738 from koba04/forward-ref-examples
React.forwardRef accepts a render function, not Functional Component
2018-04-02 10:43:58 -07:00
Toru Kobayashi
0ea7d99127 Revert "Adopt bvaughn's example"
This reverts commit 2e1554dc32.
2018-04-03 02:36:43 +09:00
Toru Kobayashi
2e1554dc32 Adopt bvaughn's example 2018-04-03 02:02:45 +09:00
Chanyeon Kim
e8cdf5128a Fix button => themed-buton (#752) 2018-04-01 14:10:34 +01:00
Tom Gallacher
17d04ac9f3 Fix: added missing component instantiation within the 'forwardRef' API example 2018-03-31 19:10:54 +01:00
Pat
e61d594b64 Minor: context/theme-detailed-app.js broken (#746)
* Minor: context/theme-detailed-app.js broken

Today I tested out the new Context API using using [CRA](https://github.com/facebook/create-react-app). 
I encountered a runtime exception, so this tiny PR is intended to make it easier for future Context API learners.

`ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor`

create-react-app@next commit da518d2238298dd5db74e9c63c12251099f87bb0

* Update theme-detailed-app.js
2018-03-30 22:07:34 +01:00
Nathan Quarles
51a864d858 Fix cDU to correctly make async request
When a new `id` prop is passed in, `getDerivedStateFromProps` sets `this.state.externalData` to `null`. If I understand the new API correctly the return value of gDSFP() either becomes the new state or is merged into the new state? If so, then `componentDidUpdate` should examine the new state (`this.state.externalData`), not `prevState.externalData`.
2018-03-30 11:44:46 -04:00
Christian Maughan Tegnér
b1d705ad60 Use correct component name in context doc example (#740)
* Use correct component name in context doc example

I'm assuming the intention was to reference the `FancyButton` component defined directly above, unless I'm misunderstanding how to read this example.

* Prettier
2018-03-30 15:08:36 +01:00
Toru Kobayashi
c72935a054 prettier 2018-03-30 15:25:16 +09:00
Toru Kobayashi
d5c449d824 React.forwardRef accepts a render function, not Functional Component 2018-03-30 14:14:29 +09:00
Brian Vaughn
73ba23fccd Updated createRef example not to use class property syntax 2018-03-29 14:56:43 -07:00
Brian Vaughn
3a36a402a5 Revert "Added inline child function caveat to Context docs"
This reverts commit 691cd4577c.
2018-03-29 09:24:43 -07:00
Brian Vaughn
797a792b77 Revert "Prettier"
This reverts commit 032576cf7b.
2018-03-29 09:24:38 -07:00
Brian Vaughn
032576cf7b Prettier 2018-03-29 09:18:46 -07:00
Brian Vaughn
691cd4577c Added inline child function caveat to Context docs 2018-03-29 09:15:30 -07:00
Brian Vaughn
a29098e958 Merge branch 'master' into 16.3-release-blog-post 2018-03-28 11:00:55 -07:00
Brian Vaughn
6afbc7b56e Added side effects props change example 2018-03-28 10:27:36 -07:00
Brian Vaughn
9113b4c829 Fixed example props/prevProps 2018-03-27 19:24:52 -07:00
Dan Abramov
77dae36663 Use examples without types in the post (#719) 2018-03-28 00:40:13 +01:00
Brian Vaughn
b7b97c0ea4 Merge branch 'master' into 16.3-release-blog-post 2018-03-27 14:34:51 -07:00
Brian Vaughn
46103921fe Changes in response to Sophie's feedback 2018-03-27 14:06:27 -07:00
Brian Vaughn
7cf5b58187 Wordsmithing 2018-03-27 10:30:38 -07:00
Brian Vaughn
e143823d7a Added create-subscription example 2018-03-24 16:26:04 -07:00
Brian Vaughn
bd06bbc1a7 Added context HOC example to reference 2018-03-24 09:30:27 -07:00
Brian Vaughn
f11a149412 Added DevTools naming consideration to React.forwardRef reference doc example 2018-03-24 08:58:20 -07:00
Brian Vaughn
587ad93751 Merge pull request #5 from alexkrolick/16.3-release-blog-post
Context updates
2018-03-23 14:09:36 -07:00
Alex Krolick
8437e3767b Fix syntax 2018-03-23 13:55:35 -07:00
Alex Krolick
b0e860404b Prettier 2018-03-23 13:54:55 -07:00
Alex Krolick
349446d8a7 Add caveats section 2018-03-23 13:51:07 -07:00
Alex Krolick
920b4f4741 Replace divs with some fake components 2018-03-23 13:20:54 -07:00