From 8d68c347966fe0bca127ae06a79dc677ab90ca4a Mon Sep 17 00:00:00 2001
From: Greg Johnston
Date: Fri, 1 Dec 2023 15:20:44 -0500
Subject: [PATCH] docs: point the book toward its new location with redirects
(#2095)
---
docs/book/README.md | 16 +-
docs/book/src/01_introduction.md | 24 +-
docs/book/src/15_global_state.md | 404 +-------------
docs/book/src/appendix_reactive_graph.md | 245 +--------
docs/book/src/async/10_resources.md | 138 +----
docs/book/src/async/11_suspense.md | 158 +-----
docs/book/src/async/12_transition.md | 85 +--
docs/book/src/async/13_actions.md | 178 +------
docs/book/src/async/README.md | 11 +-
docs/book/src/csr_wrapping_up.md | 28 +-
docs/book/src/deployment/README.md | 76 +--
docs/book/src/deployment/binary_size.md | 74 +--
docs/book/src/getting_started/README.md | 127 +----
.../src/getting_started/community_crates.md | 25 +-
docs/book/src/getting_started/leptos_dx.md | 94 +---
.../book/src/interlude_projecting_children.md | 177 +------
docs/book/src/interlude_styling.md | 114 +---
docs/book/src/islands.md | 491 +-----------------
docs/book/src/metadata.md | 51 +-
.../src/progressive_enhancement/README.md | 38 +-
.../progressive_enhancement/action_form.md | 102 +---
docs/book/src/reactivity/14_create_effect.md | 329 +-----------
docs/book/src/reactivity/README.md | 7 +-
.../src/reactivity/interlude_functions.md | 78 +--
.../src/reactivity/working_with_signals.md | 142 +----
docs/book/src/router/16_routes.md | 146 +-----
docs/book/src/router/17_nested_routing.md | 326 +-----------
docs/book/src/router/18_params_and_queries.md | 204 +-------
docs/book/src/router/19_a.md | 157 +-----
docs/book/src/router/20_form.md | 182 +------
docs/book/src/router/README.md | 25 +-
docs/book/src/server/25_server_functions.md | 152 +-----
docs/book/src/server/26_extractors.md | 89 +---
docs/book/src/server/27_response.md | 75 +--
docs/book/src/server/README.md | 13 +-
docs/book/src/ssr/21_cargo_leptos.md | 39 +-
docs/book/src/ssr/22_life_cycle.md | 45 +-
docs/book/src/ssr/23_ssr_modes.md | 158 +-----
docs/book/src/ssr/24_hydration_bugs.md | 163 +-----
docs/book/src/ssr/README.md | 19 +-
docs/book/src/testing.md | 221 +-------
docs/book/src/view/01_basic_component.md | 227 +-------
docs/book/src/view/02_dynamic_attributes.md | 264 +---------
docs/book/src/view/03_components.md | 483 +----------------
docs/book/src/view/04_iteration.md | 267 +---------
docs/book/src/view/04b_iteration.md | 280 +---------
docs/book/src/view/05_forms.md | 252 +--------
docs/book/src/view/06_control_flow.md | 386 +-------------
docs/book/src/view/07_errors.md | 177 +------
docs/book/src/view/08_parent_child.md | 466 +----------------
docs/book/src/view/09_component_children.md | 231 +-------
docs/book/src/view/README.md | 8 +-
docs/book/src/view/builder.md | 100 +---
53 files changed, 106 insertions(+), 8261 deletions(-)
diff --git a/docs/book/README.md b/docs/book/README.md
index 5ce9a90f1f..ced5b4931f 100644
--- a/docs/book/README.md
+++ b/docs/book/README.md
@@ -1,15 +1,3 @@
-This project contains the core of a new introductory guide to Leptos.
-
-It is built using `mdbook`. You can view a local copy by installing `mdbook`
-
-```bash
-cargo install mdbook
-```
-
-and run the book with
-```
-mdbook serve
-```
-
-It should be available at `http://localhost:3000`.
+The Leptos book is now available at [https://book.leptos.dev](https://book.leptos.dev).
+The source code for the book has moved to [https://github.com/leptos-rs/book](https://github.com/leptos-rs/book). Please open issues or make PRs in that repository.
diff --git a/docs/book/src/01_introduction.md b/docs/book/src/01_introduction.md
index a69dcad788..a7b691c8dd 100644
--- a/docs/book/src/01_introduction.md
+++ b/docs/book/src/01_introduction.md
@@ -1,22 +1,2 @@
-# Introduction
-
-This book is intended as an introduction to the [Leptos](https://github.com/leptos-rs/leptos) Web framework.
-It will walk through the fundamental concepts you need to build applications,
-beginning with a simple application rendered in the browser, and building toward a
-full-stack application with server-side rendering and hydration.
-
-The guide doesn’t assume you know anything about fine-grained reactivity or the
-details of modern Web frameworks. It does assume you are familiar with the Rust
-programming language, HTML, CSS, and the DOM and basic Web APIs.
-
-Leptos is most similar to frameworks like [Solid](https://www.solidjs.com) (JavaScript)
-and [Sycamore](https://sycamore-rs.netlify.app/) (Rust). There are some similarities
-to other frameworks like React (JavaScript), Svelte (JavaScript), Yew (Rust), and
-Dioxus (Rust), so knowledge of one of those frameworks may also make it easier to
-understand Leptos.
-
-You can find more detailed docs for each part of the API at [Docs.rs](https://docs.rs/leptos/latest/leptos/).
-
-**Important Note**: This current version of the book reflects the `0.5.1` release. The CodeSandbox versions of the examples still reflect `0.4` and earlier APIs and are in the process of being updated.
-
-> The source code for the book is available [here](https://github.com/leptos-rs/leptos/tree/main/docs/book). PRs for typos or clarification are always welcome.
+
+
diff --git a/docs/book/src/15_global_state.md b/docs/book/src/15_global_state.md
index 57873be079..7dd4311717 100644
--- a/docs/book/src/15_global_state.md
+++ b/docs/book/src/15_global_state.md
@@ -1,402 +1,2 @@
-# Global State Management
-
-So far, we've only been working with local state in components, and we’ve seen how to coordinate state between parent and child components. On occasion, there are times where people look for a more general solution for global state management that can work throughout an application.
-
-In general, **you do not need this chapter.** The typical pattern is to compose your application out of components, each of which manages its own local state, not to store all state in a global structure. However, there are some cases (like theming, saving user settings, or sharing data between components in different parts of your UI) in which you may want to use some kind of global state management.
-
-The three best approaches to global state are
-
-1. Using the router to drive global state via the URL
-2. Passing signals through context
-3. Creating a global state struct and creating lenses into it with `create_slice`
-
-## Option #1: URL as Global State
-
-In many ways, the URL is actually the best way to store global state. It can be accessed from any component, anywhere in your tree. There are native HTML elements like `
}
- >
- // the children will be rendered once initially,
- // and then whenever any resources has been resolved
-
- "Your shouting name is "
- {move || async_data.get()}
-
-
- }
-}
-
-fn main() {
- leptos::mount_to_body(App)
-}
-```
-
-
-
+
+
diff --git a/docs/book/src/async/12_transition.md b/docs/book/src/async/12_transition.md
index 85db85b3fc..4773504f57 100644
--- a/docs/book/src/async/12_transition.md
+++ b/docs/book/src/async/12_transition.md
@@ -1,83 +1,2 @@
-# ``
-
-You’ll notice in the `` example that if you keep reloading the data, it keeps flickering back to `"Loading..."`. Sometimes this is fine. For other times, there’s [``](https://docs.rs/leptos/latest/leptos/fn.Transition.html).
-
-`` behaves exactly the same as ``, but instead of falling back every time, it only shows the fallback the first time. On all subsequent loads, it continues showing the old data until the new data are ready. This can be really handy to prevent the flickering effect, and to allow users to continue interacting with your application.
-
-This example shows how you can create a simple tabbed contact list with ``. When you select a new tab, it continues showing the current contact until the new data loads. This can be a much better user experience than constantly falling back to a loading message.
-
-[Click to open CodeSandbox.](https://codesandbox.io/p/sandbox/12-transition-0-5-2jg5lz?file=%2Fsrc%2Fmain.rs%3A1%2C1)
-
-
-
-
-CodeSandbox Source
-
-```rust
-use gloo_timers::future::TimeoutFuture;
-use leptos::*;
-
-async fn important_api_call(id: usize) -> String {
- TimeoutFuture::new(1_000).await;
- match id {
- 0 => "Alice",
- 1 => "Bob",
- 2 => "Carol",
- _ => "User not found",
- }
- .to_string()
-}
-
-#[component]
-fn App() -> impl IntoView {
- let (tab, set_tab) = create_signal(0);
-
- // this will reload every time `tab` changes
- let user_data = create_resource(tab, |tab| async move { important_api_call(tab).await });
-
- view! {
-
-
- }
-}
-
-fn main() {
- leptos::mount_to_body(App)
-}
-```
-
-
-
+
+
diff --git a/docs/book/src/async/13_actions.md b/docs/book/src/async/13_actions.md
index 625dc33baa..cf865fc12a 100644
--- a/docs/book/src/async/13_actions.md
+++ b/docs/book/src/async/13_actions.md
@@ -1,176 +1,2 @@
-# Mutating Data with Actions
-
-We’ve talked about how to load `async` data with resources. Resources immediately load data and work closely with `` and `` components to show whether data is loading in your app. But what if you just want to call some arbitrary `async` function and keep track of what it’s doing?
-
-Well, you could always use [`spawn_local`](https://docs.rs/leptos/latest/leptos/fn.spawn_local.html). This allows you to just spawn an `async` task in a synchronous environment by handing the `Future` off to the browser (or, on the server, Tokio or whatever other runtime you’re using). But how do you know if it’s still pending? Well, you could just set a signal to show whether it’s loading, and another one to show the result...
-
-All of this is true. Or you could use the final `async` primitive: [`create_action`](https://docs.rs/leptos/latest/leptos/fn.create_action.html).
-
-Actions and resources seem similar, but they represent fundamentally different things. If you’re trying to load data by running an `async` function, either once or when some other value changes, you probably want to use `create_resource`. If you’re trying to occasionally run an `async` function in response to something like a user clicking a button, you probably want to use `create_action`.
-
-Say we have some `async` function we want to run.
-
-```rust
-async fn add_todo_request(new_title: &str) -> Uuid {
- /* do some stuff on the server to add a new todo */
-}
-```
-
-`create_action` takes an `async` function that takes a reference to a single argument, which you could think of as its “input type.”
-
-> The input is always a single type. If you want to pass in multiple arguments, you can do it with a struct or tuple.
->
-> ```rust
-> // if there's a single argument, just use that
-> let action1 = create_action(|input: &String| {
-> let input = input.clone();
-> async move { todo!() }
-> });
->
-> // if there are no arguments, use the unit type `()`
-> let action2 = create_action(|input: &()| async { todo!() });
->
-> // if there are multiple arguments, use a tuple
-> let action3 = create_action(
-> |input: &(usize, String)| async { todo!() }
-> );
-> ```
->
-> Because the action function takes a reference but the `Future` needs to have a `'static` lifetime, you’ll usually need to clone the value to pass it into the `Future`. This is admittedly awkward but it unlocks some powerful features like optimistic UI. We’ll see a little more about that in future chapters.
-
-So in this case, all we need to do to create an action is
-
-```rust
-let add_todo_action = create_action(|input: &String| {
- let input = input.to_owned();
- async move { add_todo_request(&input).await }
-});
-```
-
-Rather than calling `add_todo_action` directly, we’ll call it with `.dispatch()`, as in
-
-```rust
-add_todo_action.dispatch("Some value".to_string());
-```
-
-You can do this from an event listener, a timeout, or anywhere; because `.dispatch()` isn’t an `async` function, it can be called from a synchronous context.
-
-Actions provide access to a few signals that synchronize between the asynchronous action you’re calling and the synchronous reactive system:
-
-```rust
-let submitted = add_todo_action.input(); // RwSignal