pub fn use_atom_setter<'hook, T>() -> impl 'hook + Hook<Output = Rc<dyn Fn(T)>>where
T: Atom + 'static + 'hook,Expand description
A hook to produce a setter function for an Atom.
Returns a Rc<dyn Fn(T)>.
This hook will return a setter function that will not change across the entire lifetime of the component.
let set_username = use_atom_setter::<Username>();
set_username("John Smith".into());ยงNote
When used in function components and hooks, this hook is equivalent to:
pub fn use_atom_setter<T>() -> Rc<dyn Fn(T)>
where
T: Atom + 'static,
{
/* implementation omitted */
}