Skip to content

Commit 6eda41d

Browse files
committed
Ajusting sample
1 parent 5e2a44f commit 6eda41d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/py/reactpy/reactpy/samples/use_local_storage.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from reactpy import component, html, run
2-
from reactpy.core.hooks import use_state
2+
from reactpy.core.hooks import use_state, use_effect
33
from reactpy.backend.hooks import use_local_storage
44
from reactpy.core.types import LocalStorage
55

@@ -9,14 +9,16 @@ def App():
99
key_input, set_key_input = use_state("")
1010
val_input, set_val_input = use_state("")
1111

12-
def handle_get(e):
12+
@use_effect
13+
def handle_get():
1314
set_val_input(
1415
storage.get_item(
1516
key_input
1617
)
1718
)
1819

19-
async def handle_set(e):
20+
@use_effect
21+
async def handle_set():
2022
await storage.set_item(
2123
key_input,
2224
val_input

0 commit comments

Comments
 (0)