leptos-rs / book

The home for the Leptos book, which can be found deployed at https://book.leptos.dev
MIT License
59 stars 58 forks source link

Example for Set up `console_error_panic_hook` #114

Closed dgcosta2 closed 3 days ago

dgcosta2 commented 3 days ago

In 2.1 Set up console_error_panic_hook the example listed in

If this is unclear, click here for an example.

Uses a dependency console_log that was not imported to my environment. Although I understand the use of this example because of the line

console_error_panic_hook::set_once();

I believe that a code block in the book using the example main.rs that was created in 2 Hello World! Getting Set up for Leptos CSR Development has a better flow for the reader. Something like

use leptos::*;

fn main() {
    console_error_panic_hook::set_once();
    mount_to_body(|| view! {<p> "Hello World. This is me!" </p>});
}