From a302257129fa55abb2494ef588627fee25cdb406 Mon Sep 17 00:00:00 2001 From: obioma Date: Mon, 9 Oct 2023 22:21:09 +0200 Subject: [PATCH] docs: improvements in book - closes #1845 (#1856) --- docs/book/src/02_getting_started.md | 12 +++++++++++- docs/book/src/view/04_iteration.md | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/book/src/02_getting_started.md b/docs/book/src/02_getting_started.md index ef7e86873f..6164593fc7 100644 --- a/docs/book/src/02_getting_started.md +++ b/docs/book/src/02_getting_started.md @@ -36,13 +36,23 @@ cargo add leptos --features=csr > Using `nightly` Rust, and the `nightly` feature in Leptos enables the function-call syntax for signal getters and setters that is used in most of this book. > -> To use `nightly` Rust, you can run +> To use nightly Rust, you can either opt into nightly for all your Rust projects by running > > ```bash > rustup toolchain install nightly > rustup default nightly > ``` > +> or only for this project +> +> > ```bash +> rustup toolchain install nightly +> cd +> rustup override set nightly +> ``` +> +> [See here for more details.](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) +> > If you’d rather use stable Rust with Leptos, you can do that too. In the guide and examples, you’ll just use the [`ReadSignal::get()`](https://docs.rs/leptos/latest/leptos/struct.ReadSignal.html#impl-SignalGet%3CT%3E-for-ReadSignal%3CT%3E) and [`WriteSignal::set()`](https://docs.rs/leptos/latest/leptos/struct.WriteSignal.html#impl-SignalGet%3CT%3E-for-ReadSignal%3CT%3E) methods instead of calling signal getters and setters as functions. Make sure you've added the `wasm32-unknown-unknown` target so that Rust can compile your code to WebAssembly to run in the browser. diff --git a/docs/book/src/view/04_iteration.md b/docs/book/src/view/04_iteration.md index 65f2e91950..9d77e707a9 100644 --- a/docs/book/src/view/04_iteration.md +++ b/docs/book/src/view/04_iteration.md @@ -51,7 +51,8 @@ The fact that the _list_ is static doesn’t mean the interface needs to be stat You can render dynamic items as part of a static list. ```rust -// create a list of N signals +// create a list of 5 signals +let length = 5; let counters = (1..=length).map(|idx| create_signal(idx)); // each item manages a reactive view