Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change use_ref to use_mut_ref to support Yew hook change #20

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions yewdux-functional/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<T: Store> StoreRef<T> {
}

pub fn on_output(mut self, on_output: impl Fn(T::Output) + 'static) -> Self {
self.output = Some(use_ref(move || {
self.output = Some(use_mut_ref(move || {
Dispatch::bridge(Default::default(), on_output.into())
}));
self
Expand Down Expand Up @@ -64,7 +64,7 @@ pub fn use_store<T: Store>() -> StoreRef<T> {
let dispatch = {
let state = state.clone();
// persist the Dispatch across renders
use_ref(move || {
use_mut_ref(move || {
let on_state = Callback::from(move |new_state| {
state.set(Some(new_state));
});
Expand Down