Commit Graph

43 Commits

Author SHA1 Message Date
Niklas P
49fd7d5f11 Update reference-caveats-solution.js (#3609)
As referenced in https://reactjs.org/docs/context.html update the example to use the naming conventions used across the page.
2021-04-05 11:31:03 +02:00
Ruslan Petrov
d58c947b1e Update motivation-solution.js (#1625)
Removed unused props for clarity.
2020-03-09 16:06:53 +00:00
Ruslan Petrov
16647b39e6 Update reference-caveats-problem.js (#1626)
Added MyContext for clarity.
2020-03-09 16:02:47 +00:00
Sebastian Markbåge
896214b7d2 Document class contextType as the primary consuming mechanism (#1283)
* Document class contextType as the primary consuming mechanism

* Update context.md
2018-10-23 16:48:02 -07:00
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
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
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
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
Dan Abramov
f7cf140607 Tweak context docs (#766) 2018-04-04 15:21:16 +01:00
Chanyeon Kim
e8cdf5128a Fix button => themed-buton (#752) 2018-04-01 14:10:34 +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
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
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
bd06bbc1a7 Added context HOC example to reference 2018-03-24 09:30:27 -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
Alex Krolick
69198013e1 Use functional component 2018-03-23 11:46:47 -07:00
Alex Krolick
fb8e9e8a1b kill class props 2018-03-23 11:43:41 -07:00
Alex Krolick
f9225e2562 Remove propTypes 2018-03-23 11:41:07 -07:00
Alex Krolick
3c44882d68 Use function keyword 2018-03-23 11:39:12 -07:00
Brian Vaughn
b25276a80e Updated forward-refs example to use class component 2018-03-23 09:23:04 -07:00
Brian Vaughn
ef23c49e84 Updated multi-context example to show more indirection 2018-03-23 09:15:25 -07:00
Brian Vaughn
5864093674 Updated context-in-lifecycles example 2018-03-23 09:08:19 -07:00
Alex Krolick
9f5499789a Update highlights 2018-03-22 22:35:52 -07:00
Alex Krolick
6eb29a18f5 Combine basic examples 2018-03-22 22:22:36 -07:00
Alex Krolick
7db107b2fc + "default value" comment 2018-03-22 21:38:34 -07:00
Alex Krolick
0d32f18b09 Kill highlight 2018-03-22 21:18:38 -07:00
Alex Krolick
7b5764fed5 Add ref forwarding, lifecycle examples 2018-03-22 21:15:40 -07:00
Alex Krolick
fec6d6c141 Add mutliple contexts example 2018-03-22 21:01:59 -07:00
Alex Krolick
b49f99b7d1 Highlight whole createContext() call 2018-03-21 12:16:23 -07:00
Alex Krolick
7c6688c12c Highlight createContext() 2018-03-21 10:16:38 -07:00
Alex Krolick
6aa199516d Add solution to motivation problem 2018-03-21 10:04:11 -07:00
Alex Krolick
de22379cae Syntax tweaks 2018-03-21 09:50:09 -07:00
Alex Krolick
808e5bddaf Rephrase and reorganize
- Move Motivation to top @bvaughn
- Copy in some Motivation text from the RFC for the intro para
- Update examples
  - Remove state from simple example
  - Remove "random color" example;
  just toggle a theme variable instead
- Update highlights
2018-03-21 01:28:01 -07:00
Alex Krolick
566406e717 Add docs for new Context API (R16.3) 2018-03-06 01:07:14 -08:00