File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,22 @@ foreign import data UseState :: Type -> Type -> Type
183183-- | Runs the given effect when the component is mounted and any time the given
184184-- | dependencies change. The effect should return its cleanup function. For
185185-- | example, if the effect registers a global event listener, it should return
186- -- | and Effect which removes the listener.
186+ -- | an Effect which removes the listener.
187+ -- |
188+ -- | ```purs
189+ -- | useEffect deps do
190+ -- | timeoutId <- setTimeout 1000 (logShow deps)
191+ -- | pure (clearTimeout timeoutId)
192+ -- | ```
193+ -- |
194+ -- | If no cleanup is needed, use `pure (pure unit)` or `pure mempty` to return
195+ -- | a no-op Effect
196+ -- |
197+ -- | ```purs
198+ -- | useEffect deps do
199+ -- | logShow deps
200+ -- | pure mempty
201+ -- | ```
187202useEffect ::
188203 forall deps .
189204 Eq deps =>
You can’t perform that action at this time.
0 commit comments