You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your message, and apologies for the confusion!
The README in the repo notes that most of the examples default to the nightly feature on Leptos, which enables this syntax. The "Getting Started" mentions this distinction too, but could maybe be clearer about the fact that the book is using the nightly syntax and if you're using stable, then the function-call syntax for signals shouldn't work.
We've discussed migrating the book to use the stable syntax by default in the future. I'm generally hesitant to do that because I find the mental-model advantages of the nightly syntax really useful:
// nightly: any signal access is a function calllet(count, set_count) = create_signal(1);let double_count = move || count()*2;assert_eq!(count(), 1);assert_eq!(double_count(), 1);// stable: I have to remember whether something is a signal or derived, and update the syntax if that changeslet(count, set_count) = create_signal(1);let double_count = move || count.get()*2;// worksassert_eq!(double_count(), 1);// compile errorassert_eq!(count(), 1);
There is a bug in the first sample code in chapter "A Basic Component".
set_count(3)
should beset_count.set(3)
.The text was updated successfully, but these errors were encountered: