UseState

Trait UseState 

Source
pub trait UseState: Sealed {
    // Required method
    fn use_state<T, F>(&mut self, init: F) -> State<T>
       where F: FnOnce() -> T,
             T: Unpin + Send + Sync + 'static;
}

Required Methods§

Source

fn use_state<T, F>(&mut self, init: F) -> State<T>
where F: FnOnce() -> T, T: Unpin + Send + Sync + 'static,

创建响应式状态,适合计数器、输入框等本地状态。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl UseState for Hooks<'_, '_>