Commit Graph

66 Commits

Author SHA1 Message Date
MinYuan
f673d85616 Add useLayoutEffect to those hooks with deps (#3232) 2020-08-30 12:04:03 +02:00
Vishal Jagtap
be17215d86 Updated React and React Native links (#2824)
* DOC: Updated the React Native Home URL

* Blog: Updated the React URL Link

* Relative link added
2020-03-12 13:24:06 +00:00
Sai Ram Kunala
348a5b2888 add suffix / to example url (#1861)
was inconsistent across examples
2020-03-09 15:27:31 +00:00
Arshita Kakkar
5fc494752c Doc error (#2301)
Changed Line 94- You can't use Hooks *inside* of a class component, but you can definitely mix classes and function components with Hooks in a single tree.  
to 
"You can't use Hooks *inside* a class component, but you can definitely mix classes and function components with Hooks in a single tree. "
2020-03-09 13:35:18 +00:00
Arshita Kakkar
cc007751ca Documentation correction (#2304)
* Documentation error

Line 290 - ". However, instead we recommend to split state into multiple state variables based on which values tend to change together."
Both 'however' and 'instead' are contrasting words and only one of them should be used. 
Either "Instead we recommend to split state into multiple state variables based on which values tend to change together." OR "However, we recommend to split state into multiple state variables based on which values tend to change together."
Updated the sentence.

* Updated 'however' to 'instead'

Line 290 updated to - 
Instead, **we recommend to split state into multiple state variables based on which values tend to change together.**

* Update hooks-faq.md

Co-authored-by: Sunil Pai <threepointone@fb.com>
2020-03-09 13:34:04 +00:00
mknapper1
fe5ec2c55d Fix typo in hooks-faq.md (#2649)
* Fix typo in hooks-faq.md

* Update hooks-faq.md

* Update hooks-faq.md

Co-authored-by: Sophie Alpert <git@sophiebits.com>
Co-authored-by: Sunil Pai <threepointone@oculus.com>
2020-03-09 12:21:12 +00:00
Muhammad Arslan Sajid
69b15a2117 update hooks-faq.md (#2806)
1- Added getDerivedStateFromError lifecycle method to "Do Hooks cover all use cases for classes?"
2- Added getSnapshotBeforeUpdate lifecycle method to "How do lifecycle methods correspond to Hooks?"
2020-03-09 11:36:19 +00:00
Anthony Valera
fc0e690b4e Changes variable declarations in code examples (#2345)
Converts a few `let` declarations for constant values to `const` in code examples
2020-01-03 01:53:52 +03:00
Sophie Alpert
f2920cc67b Amend DOM measurement hooks example to be clear about shortcomings
Fixes #2556.
2020-01-01 08:32:01 -08:00
Wes Lord
060d129aa0 Change usePrevious example in hooks-faq.md (#2387)
In the example, `count` is initialized to 0 and then multiplied by 100... which is 0.

Changing this to addition so the previous value will differ from the current value.
2019-10-02 11:35:01 -07:00
Bouwe K. Westerdijk
647b639259 React Router also supports hooks now (#2374) 2019-09-30 15:56:32 +03:00
Cool4ZBL
2efb26ee47 Update hooks-faq.md (#2340)
Add missing `{`
2019-09-12 19:26:19 +03:00
Jeremy Deutsch
71ec859df2 Update hooks-faq.md with info for React Native (#1875)
For the FAQ question "Which versions of React include Hooks?", the current version of React Native (which supports Hooks) is now listed, along with a link to the blog post for that release.
2019-08-15 23:23:48 +01:00
Lukasz Ostrowski
6a1d86c712 Links to React Redux hooks api (#2202)
* Links to React Redux hooks api

Since Hooks are already released for Redux, link the docs

* Update hooks-faq.md


Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2019-08-12 10:08:30 +03:00
Eric Stout
975b4d2adb Fix typo (#2183) 2019-08-12 10:04:47 +03:00
Dan Abramov
7382e4e4ec Link FAQ to testing recipes 2019-08-10 17:02:40 +01:00
Sunil Pai
8be8bf9d2f Testing Docs (#2165)
* Testing Docs

This expands the testing docs for reactjs.org. It adds 3 main docs -

- testing.md: An entry point to the testing docs
- testing-recipes.md: Common patterns when writing tests for React Components.
- testing-environments.md: Setting up your testing environment.

With help from @alexkrolick, @kentcdodds, @gaearon
2019-08-08 22:43:59 +01:00
Peng Jie
5dca78b7e3 docs(hooks): fix typo (#2161) 2019-07-21 22:12:27 -07:00
UmaR Aamer
06dd4cbe97 React Native added support for hooks in 0.59 (#2121)
* React Native added support for hooks in 0.59

React Native 0.59 and above already support React Hooks, this line is no longer necessary, causes confusion for some people that it is not working right now. We can also mention React Native version if needed.

* update with react native mention of hooks support

* Update content/docs/hooks-faq.md

suggested changes

Co-Authored-By: Alexey Pyltsyn <lex61rus@gmail.com>
2019-07-09 18:33:15 +03:00
Neil de Carteret
18f662ce41 Update hooks-faq.md (#2113)
* Update hooks-faq.md

I tripped up slightly while reading this example for using the callback form of a state setter inside an effect. I've added a few lines that might help a hook newbie grok the differences between the examples.

* Update hooks-faq.md

* Update hooks-faq.md
2019-07-01 08:46:54 -07:00
Riley Avron
cb5a61cdbf Add missing function call to example (#2102)
An example for useEffect omitted the actual invocation of the function in question.
2019-06-25 17:15:19 -07:00
Angelos Orfanakos
2dccf4699d Remove redundant "reading" word from hooks faq (#2036) 2019-05-25 10:44:12 -07:00
Gavin Elster
8d9b002130 Fix typo (#2021)
* Fix typo

Adds a missing word

* Update content/docs/hooks-faq.md

Co-Authored-By: Alexey Pyltsyn <lex61rus@gmail.com>
2019-05-22 13:34:04 +03:00
Misha Moroshko
b3d4fe5efb Keep hook links consistent (#1323) 2019-05-18 14:22:00 +03:00
Kent C. Dodds
b91049c057 inputs array > dependencies array (#1957)
* inputs array > dependencies array

I think initially this was referred to as the "inputs array" in the docs, then it was changed to the "dependencies array" everywhere except it looks like a few were missed.

* inputs array > dependencies array

I think initially this was referred to as the "inputs array" in the docs, then it was changed to the "dependencies array" everywhere except it looks like a few were missed.
2019-05-09 10:35:27 -07:00
Dan Abramov
ad6687e25e Simplify the observer example 2019-05-06 03:05:28 +01:00
Alexey Pyltsyn
066479b69a Generate ids for new headers 2019-04-27 22:13:12 +03:00
Dan Abramov
ac4aa6546e Add more explanations to Hooks API page (#1845)
* Add more explanations to API page

* static

* add info about useLayoutEffect

* Update content/docs/hooks-reference.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* nits

* nit
2019-03-19 17:12:44 +00:00
Dan Abramov
806da34988 Add a DOM measurement recipe to Hooks FAQ (#1843)
* Add a DOM measurement recipe to Hooks FAQ

* Update content/docs/hooks-faq.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* Update content/docs/hooks-faq.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>
2019-03-19 15:28:18 +00:00
Dan Abramov
352c3ff01f Fix example 2019-03-13 18:24:10 +00:00
Dan Abramov
877b189758 Fix wording 2019-03-13 15:46:05 +00:00
Dan Abramov
474de38b2c Use another example 2019-03-13 15:42:01 +00:00
Dan Abramov
110a318d1e Link to a data fetching demo 2019-03-13 15:38:51 +00:00
Dan Abramov
2cd4d0cf5d Add more info to FAQ about deps (#1815)
* Add more info to FAQ about deps

* Update content/docs/hooks-faq.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* Update content/docs/hooks-faq.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* Update content/docs/hooks-faq.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* Update content/docs/hooks-faq.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* Update content/docs/hooks-effect.md

Co-Authored-By: gaearon <dan.abramov@gmail.com>

* tweaks

* tweak
2019-03-13 13:59:42 +00:00
Dan Abramov
f99cc73499 Revert "Small typo fix" (#1738)
* Revert "Small typo fix"

* Update hooks-faq.md
2019-02-23 11:29:51 +00:00
Alexey Pyltsyn
d615c5b7bc Merge pull request #1317 from tusharkhatiwada/typo-hooks-faq
Small typo fix
2019-02-23 00:32:58 +03:00
David Svetlecic
7b5f4cf604 Add 'you' 2019-02-20 16:38:42 -06:00
Saransh Kataria
c8184872f8 Merge pull request #1324 from moroshko/patch-6
Tip => Note
2019-02-19 19:09:55 -08:00
Nat Alison
cde52ae60d add missing headings on hooks-faq 2019-02-12 14:47:38 -08:00
Nat Alison
25df15b83e reapply, correctly generating links 2019-02-06 18:03:29 -08:00
Nat Alison
dc1e5366e3 revert id adding 2019-02-06 18:00:52 -08:00
Nat Alison
3e49e971d0 add everything else again 2019-02-06 17:22:04 -08:00
Brian Vaughn
a0db3e7f17 Replaced inaccurate comments 2019-02-05 18:39:25 +00:00
Dan Abramov
601c016f49 testing 2019-02-05 18:05:36 +00:00
Dan Abramov
d460a9b106 Docs updates 2019-02-04 15:34:23 +00:00
Dan Abramov
f510e11312 Reword intro 2019-01-25 18:08:48 +00:00
Dan Abramov
08b6e4b876 Update docs for stable Hooks 2019-01-24 18:07:22 +00:00
Dan Abramov
024b5b6173 Bump alpha 2019-01-20 20:31:35 +00:00
Dan Abramov
a946fb3783 Warn against side effects in useMemo (#1576) 2019-01-19 19:52:32 +00:00
Dan Abramov
26b0eb258a typo 2019-01-17 17:31:10 +00:00