Skip to content

Commit f13c507

Browse files
committed
fix doc issue
not sure why this was not caught earlier
1 parent 5e27866 commit f13c507

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/idom/core/hooks.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,19 @@ class LifeCycleHook:
561561
562562
.. testcode::
563563
564-
from idom.core.hooks import LifeCycleHook, DID_RENDER_EFFECT
564+
from idom.core.hooks import (
565+
current_hook,
566+
LifeCycleHook,
567+
COMPONENT_DID_RENDER_EFFECT,
568+
)
565569
566570
567571
# this function will come from a layout implementation
568572
schedule_render = lambda: ...
569573
570574
# --- start life cycle ---
571575
572-
hook = hooks.LifeCycle(schedule_render)
576+
hook = LifeCycle(schedule_render)
573577
574578
# --- start render cycle ---
575579
@@ -582,11 +586,11 @@ class LifeCycleHook:
582586
...
583587
584588
# the component may access the current hook
585-
assert hooks.current_hook() is hook
589+
assert current_hook() is hook
586590
587591
# and save state or add effects
588592
current_hook().use_state(lambda: ...)
589-
current_hook().use_effect(DID_RENDER_EFFECT, lambda: ...)
593+
current_hook().use_effect(COMPONENT_DID_RENDER_EFFECT, lambda: ...)
590594
finally:
591595
hook.unset_current()
592596

0 commit comments

Comments
 (0)