From 9a00f7f4925afd0c3b7cc6eff9c978c808a85969 Mon Sep 17 00:00:00 2001 From: Ke7in <60681675+luckynumberke7in@users.noreply.github.com> Date: Thu, 29 Dec 2022 23:23:43 -0500 Subject: [PATCH] Fix a few typos in README.md Minor, but I noticed 1 while reading the file and decided to skim the rest of the file. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fae40b85a..476c5a19a 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Leptos is a full-stack, isomorphic Rust web framework leveraging fine-grained re - **Isomorphic**: Leptos provides primitives to write isomorphic server functions, i.e., functions that can be called with the “same shape” on the client or server, but only run on the server. This means you can write your server-only logic (database requests, authentication etc.) alongside the client-side components that will consume it, and call server functions as if they were running in the browser. - **Web**: Leptos is built on the Web platform and Web standards. The router is designed to use Web fundamentals (like links and forms) and build on top of them rather than trying to replace them. - **Framework**: Leptos provides most of what you need to build a modern web app: a reactive system, templating library, and a router that works on both the server and client side. -- **Fine-grained reactivity**: The entire framework is build from reactive primitives. This allows for extremely performant code with minimal overhead: when a reactive signal’s value changes, it can update a single text node, toggle a single class, or remove an element from the DOM without any other code running. (_So, no virtual DOM!_) +- **Fine-grained reactivity**: The entire framework is built from reactive primitives. This allows for extremely performant code with minimal overhead: when a reactive signal’s value changes, it can update a single text node, toggle a single class, or remove an element from the DOM without any other code running. (_So, no virtual DOM!_) - **Declarative**: Tell Leptos how you want the page to look, and let the framework tell the browser how to do it. ## Learn more @@ -114,7 +114,7 @@ On the surface level, these libraries may seem similar. Yew is, of course, the m - **VDOM vs. fine-grained:** Yew is built on the virtual DOM (VDOM) model: state changes cause components to re-render, generating a new virtual DOM tree. Yew diffs this against the previous VDOM, and applies those patches to the actual DOM. Component functions rerun whenever state changes. Leptos takes an entirely different approach. Components run once, creating (and returning) actual DOM nodes and setting up a reactive system to update those DOM nodes. - **Performance:** This has huge performance implications: Leptos is simply _much_ faster at both creating and updating the UI than Yew is. -- **Mental model:** Adopting fine-grained reactivity also tends to simplify the mental model. There are no surprising components re-renders because there are no re-renders. Your app can be divided into components based on what makes sense for your app, because they have no performance implications. +- **Mental model:** Adopting fine-grained reactivity also tends to simplify the mental model. There are no surprising component re-renders because there are no re-renders. Your app can be divided into components based on what makes sense for your app, because they have no performance implications. ### How is this different from Sycamore? @@ -140,4 +140,4 @@ There are some practical differences that make a significant difference: fn do_work_on_signal(my_signal: impl Fn() -> i32) { ... } ``` -- **Signals and scopes are `'static`:** Both Leptos and Sycamore ease the pain of moving signals in closures (in particular, event listeners) by making them `Copy`, to avoid the `{ let count = count.clone(); move |_| ... }` that's very familiar in Rust UI code. Sycamore does this by using bump allocation to tie the lifetimes of its signals to its scopes: since references are `Copy`, `&'a Signal` can be moved into a closure. Leptos does this by using arena allocation and passing around indices: types like `ReadSignal`, `WriteSignal`, and `Memo` are actually wrapper for indices into an arena. This means that both scopes and signals are both `Copy` and `'static` in Leptos, which means that they can be moved easily into closures without adding lifetime complexity. +- **Signals and scopes are `'static`:** Both Leptos and Sycamore ease the pain of moving signals in closures (in particular, event listeners) by making them `Copy`, to avoid the `{ let count = count.clone(); move |_| ... }` that's very familiar in Rust UI code. Sycamore does this by using bump allocation to tie the lifetimes of its signals to its scopes: since references are `Copy`, `&'a Signal` can be moved into a closure. Leptos does this by using arena allocation and passing around indices: types like `ReadSignal`, `WriteSignal`, and `Memo` are actually wrappers for indices into an arena. This means that both scopes and signals are both `Copy` and `'static` in Leptos, which means that they can be moved easily into closures without adding lifetime complexity.