Skip to content

Commit

Permalink
feat: add use_effect_ to handle cleanup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ghivert committed Aug 21, 2024
1 parent 4e565ad commit fd3de3e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions redraw/src/redraw.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd3de3e

Please sign in to comment.