The following pattern is used to pass states between elements:
#[derive(Props)]
struct ResultsProps {
current_idx: Option<State<isize>>,
}
#[component]
fn Results(props: &ResultsProps, mut hooks: Hooks) -> impl Into<AnyElement<'static>> {
let Some(mut current_idx) = props.current_idx else {
panic!("index is required");
};
...
}
I propose to add an attribute #[iocraft(required)] to mark fields as non-optional when constructing elements
#[derive(Props)]
struct ResultsProps {
#[iocraft(required)]
current_idx: State<isize>,
}
#[component]
fn Results(props: &ResultsProps, mut hooks: Hooks) -> impl Into<AnyElement<'static>> {
...
}
The following pattern is used to pass states between elements:
I propose to add an attribute
#[iocraft(required)]to mark fields as non-optional when constructing elements