-
If I don't want a local state I have to pass it by the parent component, right? E.g. in TEA you'd define a What is the idiomatic #[component]
fn Foo<F,B,Z>(
// --- static data --- ///
static_prop_foo: bool,
static_prop_bar: u64,
static_prop_baz: &str,
// ... and many more
// --- dynamic data --- ///
dynamic_prop_foo: ReadSignal<FooData>,
dynamic_prop_bar: WriteSignal<BarData>,
dynamic_prop_baz: RwSignal<BazData>,
// ... and many more
// --- event handlers --- ///
on_foo: F,
on_bar: B,
on_baz: Z
// ... and many more
) -> impl IntoView
where
F: Fn(FooEvent) + Clone + 'static,
B: Fn(BarEvent) + Clone + 'static,
Z: Fn(BazEvent) + Clone + 'static,
{
todo!()
} |
Beta Was this translation helpful? Give feedback.
Answered by
gbj
Jan 14, 2023
Replies: 1 comment 3 replies
-
There are a few different questions to ask yourself when you find yourself in this situation:
Without a more concrete example it's a bit hard to see what the answer is in your case, but those are some of the possibilities. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
flosse
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a few different questions to ask yourself when you find yourself in this situation:
provide_context
and receive them withuse_context
instead of via props?struct
and a messageenum
to create a state machine as I would in Elm, and pass that as a signal?Without a more concrete example it's a bit hard to see what the answer is in your case, but those are some of the possibilities.