Closed sybernatus closed 11 months ago
What does the surrounding code look like? Selectors are only supported in functional components
In a functional component you could write it like this:
let id_token: Rc<String> = use_selector(|state: &RootState| state.id_token.clone());
info!(format!("id_token {}", &id_token));
Outside (and inside) of a yew component you can query the state like this:
let root_state_dispatch = Dispatch::<RootState>::new();
let root_state: Rc<RootState> = root_state_dispatch.get();
info!(format!("id_token {}", &root_state.id_token));
Thanks @christophbeberweil & @intendednull it works.
I was effectively using the functional pattern in a yew component.
I have the following state :
I'm trying to use the
use_selector
function in a yew component on my id_token.I have the following error :
I've tried multiple things but I can't find the way to display my
id_token
in the log or even in the Html. Any recommendation to fix this issue?