From fd3de3eee78ded8d7f6687d59dfd3b2641e97bb9 Mon Sep 17 00:00:00 2001 From: Guillaume Hivert Date: Wed, 21 Aug 2024 16:38:00 +0200 Subject: [PATCH] feat: add use_effect_ to handle cleanup functions --- redraw/src/redraw.gleam | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/redraw/src/redraw.gleam b/redraw/src/redraw.gleam index 483e08a..c25522f 100644 --- a/redraw/src/redraw.gleam +++ b/redraw/src/redraw.gleam @@ -203,6 +203,13 @@ pub fn use_deferred_value(value: a) -> a @external(javascript, "react", "useEffect") pub fn use_effect(value: fn() -> Nil, dependencies: a) -> Nil +/// Let you synchronize a component with an external system. Allow to return +/// a cleanup function. +/// +/// [Documentation](https://react.dev/reference/react/useEffect) +@external(javascript, "react", "useEffect") +pub fn use_effect_(value: fn() -> fn() -> Nil, dependencies: a) -> Nil + /// Version of useEffect that fires before the browser repaints the screen. /// /// [Documentation](https://react.dev/reference/react/useLayoutEffect)