@@ -17,10 +17,8 @@ cases the :ref:`Basic Hooks` should be enough, however the remaining
1717Basic Hooks
1818===========
1919
20- Common hooks that should fulfill a majority of use cases.
2120
22-
23- use_state
21+ Use State
2422---------
2523
2624.. code-block ::
@@ -45,8 +43,8 @@ of ``new_state``.
4543.. note ::
4644
4745 The identity of ``set_state `` is guaranteed to be preserved across renders. This
48- means it can safely be omitted from dependency lists in :ref: `use_effect ` or
49- :ref: `use_callback `.
46+ means it can safely be omitted from dependency lists in :ref: `Use Effect ` or
47+ :ref: `Use Callback `.
5048
5149
5250Functional Updates
@@ -92,7 +90,7 @@ result in a re-render:
9290 set_state(state)
9391
9492
95- use_effect
93+ Use Effect
9694----------
9795
9896.. code-block ::
@@ -186,18 +184,15 @@ There are **three important subtleties** to note about using asynchronous effect
186184Supplementary Hooks
187185===================
188186
189- Hooks that fulfill some less common, but still important use cases using variations of
190- the :ref: `Basic Hooks `.
191-
192187
193- use_reducer
188+ Use Reducer
194189-----------
195190
196191.. code-block ::
197192
198193 state, dispatch_action = use_reducer(reducer, initial_state)
199194
200- An alternative and derivative of :ref: `use_state ` the ``use_reducer `` hook, instead of
195+ An alternative and derivative of :ref: `Use State ` the ``use_reducer `` hook, instead of
201196directly assigning a new state, allows you to specify an action which will transition
202197the previous state into the next state. This transition is defined by a reducer function
203198of the form ``(current_state, action) -> new_state ``. The ``use_reducer `` hook then
@@ -218,17 +213,17 @@ We can rework the :ref:`Functional Updates` counter example to use ``use_reducer
218213
219214 The identity of the ``dispatch_action `` function is guaranteed to be preserved
220215 across re-renders throughout the lifetime of the component. This means it can safely
221- be omitted from dependency lists in :ref: `use_effect ` or :ref: `use_callback `.
216+ be omitted from dependency lists in :ref: `Use Effect ` or :ref: `Use Callback `.
222217
223218
224- use_callback
219+ Use Callback
225220------------
226221
227222.. code-block ::
228223
229224 memoized_callback = use_callback(lambda: do_something(a, b), [a, b])
230225
231- A derivative of :ref: `use_memo `, the ``use_callback `` hook returns a
226+ A derivative of :ref: `Use Memo `, the ``use_callback `` hook returns a
232227`memoized <memoization >`_ callback. This is useful when passing callbacks to child
233228components which check reference equality to prevent unnecessary renders. The of
234229``memoized_callback `` will only change when the given dependencies do.
@@ -243,7 +238,7 @@ components which check reference equality to prevent unnecessary renders. The of
243238
244239
245240
246- use_memo
241+ Use Memo
247242--------
248243
249244.. code-block ::
@@ -277,7 +272,7 @@ after) and should not incur side effects.
277272 to help enforce this.
278273
279274
280- use_ref
275+ Use Ref
281276-------
282277
283278.. code-block ::
@@ -290,7 +285,7 @@ The identity of the ``Ref`` object will be preserved for the lifetime of the com
290285
291286A ``Ref `` is most useful if you need to incur side effects since updating its
292287``.current `` attribute doesn't trigger a re-render of the component. You'll often use this
293- hook alongside :ref: `use_effect ` or in response to component event handlers.
288+ hook alongside :ref: `Use Effect ` or in response to component event handlers.
294289:ref: `The Game Snake ` provides a good use case for ``use_ref ``.
295290
296291
0 commit comments