Replies: 1 comment 1 reply
-
It seems like this made it easier for you to use the framework. That's great!
Nope! Here are a few reasons:
If you think it's a helpful addition to the syntax, I'd recommend publishing it as a crate. Happy to add it to the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
thank you for creating this amazing project!
While reading through the book and trying out Leptos, I found myself struggling with the
move ||
scheme being used to create reactive functions. Given that there is a dedicated chapter on this matter in the book, it appears that this is a more widespread issue.Subjectively speaking, for me this is caused by the following two reasons:
move ||
in app code, I have to constantly remind me that this is used as reactive function in the framework, not as "general" Rust function (I am conditioned to usemove
only for stuff like passing lambdas to other processor functions as argument etc.)view!
macro (citing from the dedicated chapter: "It sometimes looks a little silly")While following the book, I decided to create this small macro:
Using this macro improved my developer experience in such a significant way that I decided to share it here. This the example from the mentioned chapter rewritten with the
react!
macro:As another example, I rewrote the CodeSandbox Section example from the book's Control Flow chapter in this gist.
This immediately allows any developer to determine where the reactivity in the view happens and allows tell reactive from non-reactive
move ||
usage apart.Adding this macro to Leptos would - in my opinion - have the following pros:
react!
or stick withmove ||
Cons:
Is this something you would consider adding to Leptos?
Beta Was this translation helpful? Give feedback.
All reactions