diff --git a/packages/sycamore-reactive/src/effect.rs b/packages/sycamore-reactive/src/effect.rs index 8191b6db1..567d71e8d 100644 --- a/packages/sycamore-reactive/src/effect.rs +++ b/packages/sycamore-reactive/src/effect.rs @@ -403,7 +403,7 @@ where /// dispatch(Msg::Decrement); /// assert_eq!(*state.get(), 0); /// ``` -pub fn create_reducer(initial: Out, reduce: F) -> (StateHandle, impl Fn(Msg)) +pub fn create_reducer(initial: Out, reduce: F) -> (StateHandle, Rc) where F: Fn(&Out, Msg) -> Out, { @@ -416,7 +416,7 @@ where } }; - (memo.into_handle(), dispatcher) + (memo.into_handle(), Rc::new(dispatcher)) } /// Run the passed closure inside an untracked dependency scope.