From 2bb65ef3d85e82b6bd134a714e51e27876037734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Paris?= Date: Wed, 13 May 2020 19:07:33 +0200 Subject: [PATCH] fix: display alert timeout in story --- stories/useLatest.story.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stories/useLatest.story.tsx b/stories/useLatest.story.tsx index 6c2969b5..642e331c 100644 --- a/stories/useLatest.story.tsx +++ b/stories/useLatest.story.tsx @@ -6,18 +6,19 @@ import ShowDocs from './util/ShowDocs'; const Demo = () => { const [count, setCount] = React.useState(0); const latestCount = useLatest(count); + const timeoutMs = 3000; function handleAlertClick() { setTimeout(() => { alert(`Latest count value: ${latestCount.current}`); - }, 3000); + }, timeoutMs); } return (

You clicked {count} times

- +
); };