I have a Q. regarding use_effect usage:
In my code here:
#[component]
pub(crate) fn Setup2fa(user_id: String, is_signup: bool) -> Element {
let mut others = use_context_provider(|| {
Signal::new(Others { is_page_loading: true, ..Default::default() })
});
use_effect(move || {
if is_signup {
show_timed_toast(&mut success_toast_details, "New Password Set!".to_string(), None);
others.write().purpose = OtpFor::Setup2fa;
} else {
others.write().purpose = OtpFor::Renew2fa;
}
});
others().purpose value is not getting updated based on is_signup value. Am I missing anything? Anyone pls?