Closed JosiahParry closed 5 months ago
I now see this later on... but it would be great to have that before the example or a nice mention that it wont compile or even that cute confused ferris image.
You’ll need to have serde as a dependency with the derive featured enabled for the macro to work properly. You can easily add it to Cargo.toml with cargo add serde --features=derive.
It would be really nice if the content of the book can be reproduced and followed along with!
Thanks for the feedback!
Initially this was done to highlight the most important bits of the code, but I think I've found a way to hide the less important parts of more complete examples so that ppl can copy/paste if they so choose.
Just so you know, it'll take a while to make all those changes, though.
In the meantime, there are still the CodeSandbox examples at the bottom of some of the book's pages, as well as the more complete examples in the main repo, available here: https://github.com/leptos-rs/leptos/tree/main/examples
serde
import no longer needed in 0.6, so I'll close this issue.
Thank you very much for this book! It's very helpful and i'm learning a lot.
The leptos book introduces server functions in chapter 14. Prior to this, in chapter 13 we are guided in creating a leptos app using SSR with cargo leptos.
In the very first example of using server functions https://book.leptos.dev/server/25_server_functions.html#using-server-functions we create an
add_todo()
intodo.rs
this does not include any imports to the code chunk leaving the reader (who most likely is like me, has no idea what imports are needed) to figure out what imports are needed.Adding the standard
use leptos::*;
does not fix the compiler error. Guess work with the rust analyzer leads me touse leptos_server::*;
none of which gets the to compile and are left with a compiler errorIt would be really nice if the content of the book can be reproduced and followed along with!