rename memo to selector
This commit is contained in:
1 parent
646c161c7d
commit
2c7d0700d4
3 files changed
+5
-5
No files matched your search
@@ -3,7 +3,7 @@ pub use rt::*;
|
||||
mod effect;
|
||||
pub use effect::*;
|
||||
mod impls;
|
||||
mod memo;
|
||||
pub use memo::*;
|
||||
mod selector;
|
||||
pub use selector::*;
|
||||
pub(crate) mod signal;
|
||||
pub use signal::*;
|
||||
@@ -9,7 +9,7 @@ pub fn use_selector<R: PartialEq>(
|
||||
*cx.use_hook(|| selector(f))
|
||||
}
|
||||
|
||||
fn selector<R: PartialEq>(mut f: impl FnMut() -> R + 'static) -> ReadOnlySignal<R> {
|
||||
pub fn selector<R: PartialEq>(mut f: impl FnMut() -> R + 'static) -> ReadOnlySignal<R> {
|
||||
let state = Signal::<R> {
|
||||
inner: CopyValue::invalid(),
|
||||
};
|
||||
@@ -26,7 +26,7 @@ fn memos_rerun() {
|
||||
let mut signal = use_signal(cx, || 0);
|
||||
let memo = cx.use_hook(move || {
|
||||
to_owned![counter];
|
||||
memo(move || {
|
||||
selector(move || {
|
||||
counter.borrow_mut().effect += 1;
|
||||
println!("Signal: {:?}", signal);
|
||||
signal.value()
|
||||
@@ -102,7 +102,7 @@ fn memos_prevents_component_rerun() {
|
||||
|
||||
let memo = cx.use_hook(move || {
|
||||
to_owned![counter];
|
||||
memo(move || {
|
||||
selector(move || {
|
||||
counter.borrow_mut().effect += 1;
|
||||
println!("Signal: {:?}", signal);
|
||||
signal.value()
|
||||
Reference in new issue
Block a user