Repository navigation
Commit 6c56313
committed
docs(examples): make every documented handler a coroutine
Handlers must be coroutines now, so each example hoists its one-liner into a
named 'async def' (or a factory), reads event data with 'await event.<path>',
and batches sibling reads through 'event.read(...)' or asyncio.gather so the
round trip is paid once.1 parent b278ab4 commit 6c56313
189 files changed
Lines changed: 1047 additions & 504 deletions
File tree
- docs
- examples
- choosing_the_state_structure
- coordinates_grouped
- coordinates_separate
- feedback_flags
- feedback_status
- full_name_derived
- full_name_stored
- places_flat
- places_nested
- snacks_duplicated
- snacks_normalized
- communicate_data_between_server_and_client/file_upload
- creating_backends/custom_backend
- creating_html_tags
- creating_vdom_event_handlers
- extracting_state_logic_into_a_reducer
- reducer_action_data
- reducer_frozen_value
- reducer_mutates
- reducer_swapped
- tasks_reducer
- tasks_state
- keeping_components_pure/side_effects
- lifecycle_of_reactive_effects
- blocking_effect
- frozen_body
- gating
- overlapping_runs
- reactive_values
- setup_cleanup
- silent_failure
- manipulating_the_dom_with_refs/toggle_visibility
- passing_data_deeply_with_context
- context_theme
- prop_drilling
- provider_always
- provider_remount
- self_provider
- passing_props_to_a_component/changing
- preserving_and_resetting_state
- different_components
- different_positions
- messenger
- reset_with_key
- same_position
- two_positions
- queueing_a_series_of_state_updates
- batched
- replace_then_update
- update_then_replace
- updaters
- quick_start
- reacting_to_input_with_state
- final_form
- status_mock
- styleguide
- reference_client_api
- hand_written_bootstrap
- import_map
- reference_jinja
- component_tag
- pyscript_component
- reference_protocol_structure
- counter_app
- observe_protocol
- reference_reactpy_csr/csr_root
- reference_reactpy_middleware
- mount_snippet
- wrapper
- reference_reactpy/standalone
- reference_rules_of_hooks/conditional_hook
- reference_rules_of_react
- impure_render
- pure_render
- reference_use_callback
- stable_identity
- stale_handler
- tracked_handler
- reference_use_context/theme_provider
- reference_use_debug_value
- custom_hook
- expensive_message
- reference_use_effect
- cleanup
- dependencies
- inferred
- minimal
- reference_use_memo
- dependencies_none
- deps_inferred
- expensive_calc
- missing_dependency
- reference_use_reducer
- expensive_init
- replace_not_mutate
- stale_reducer
- todos
- reference_use_ref
- no_rerender
- set_current
- stopwatch
- reference_use_state
- checkbox
- counter
- form
- previous_render
- reset_by_key
- text_field
- updater
- referencing_values_with_refs
- counter
- ref_counter
- state_counter
- removing_effect_dependencies
- equality_deps
- hoisted_constant
- next_state_updater
- restarting_interval
- stable_interval
- unread_dep
- render_and_commit/uncontrolled_input
- responding_to_events
- handler_props
- naming_props
- prevent_default
- propagation
- reading_props
- stop_propagation
- reusing_logic_with_custom_hooks
- callback_dep
- extract_hook
- handler_argument
- hook_order_safe
- hook_order_violation
- isolated_state
- scaling_up_with_reducer_and_context
- task_context
- task_state_props
- task_wiring
- separating_events_from_effects
- callback_frozen_dep
- callback_identity
- handler_freshness
- intent_in_effect
- intent_in_handler
- latest_value_ref
- sharing_state_between_components
- independent
- lifted
- state_a_components_memory
- isolated_galleries
- multiple_state
- regular_variable
- state_variable
- state_as_a_snapshot
- delayed_handler
- delayed_message
- handler_sees_snapshot
- snapshot_in_time
- triggers_renders
- synchronizing_with_effects
- analytics
- cleanup
- declare_effect
- fetching
- inferred
- latest_state
- non_react_widget
- per_render
- subscribe
- thinking_in_react
- tutorial_tic_tac_toe
- declaring_winner
- guarded_turns
- lifting_state
- mutating
- showing_moves
- square_state
- storing_history
- taking_turns
- time_travel
- updating_arrays_in_state
- add_to_array
- insert_at_index
- objects_in_arrays
- other_changes
- remove_from_array
- replace_item
- transform_array
- updating_objects_in_state
- form_single_handler
- form_spread
- moving_dot
- nested_object
- vdom_mutations
- you_might_not_need_an_effect
- adjust_on_prop_change
- expensive_filter
- external_store
- form_submit
- full_name_derived
- full_name_effect
- parent_notify
- reset_with_key
- transform_data
- overrides/homepage_examples
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
28 | | - | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | | - | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
9 | 20 | | |
10 | 21 | | |
11 | 22 | | |
| |||
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
42 | | - | |
| 49 | + | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
42 | | - | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
30 | 42 | | |
31 | 43 | | |
32 | 44 | | |
| |||
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
45 | | - | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| |||
0 commit comments