Skip to content

Commit

Permalink
templates
Browse files Browse the repository at this point in the history
  • Loading branch information
StuartHarris committed Oct 1, 2023
1 parent 2a1c0a0 commit f7759b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion templates/simple_counter/web-leptos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
leptos = { version = "0.4.10", features = ["csr"] }
leptos = { version = "0.5.0", features = ["csr"] }
shared = { path = "../{{core_dir}}" }
18 changes: 8 additions & 10 deletions templates/simple_counter/web-leptos/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
mod core;

use leptos::{
component, create_effect, create_signal, view, IntoView, Scope, SignalGet, SignalUpdate,
};
use leptos::{component, create_effect, create_signal, view, IntoView, SignalGet, SignalUpdate};
use {{core_name}}::Event;

#[component]
fn RootComponent(cx: Scope) -> impl IntoView {
fn RootComponent() -> impl IntoView {
let core = core::new();
let (view, render) = create_signal(cx, core.view());
let (event, set_event) = create_signal(cx, Event::Reset);
let (view, render) = create_signal(core.view());
let (event, set_event) = create_signal(Event::Reset);

create_effect(cx, move |_| {
create_effect(move |_| {
core::update(&core, event.get(), render);
});

view! {cx,
view! {
<section class="box container has-text-centered m-5">
<p class="is-size-5">{move || view.get().count}</p>
<div class="buttons section is-centered">
Expand All @@ -40,7 +38,7 @@ fn RootComponent(cx: Scope) -> impl IntoView {
}

fn main() {
leptos::mount_to_body(|cx| {
view! { cx, <RootComponent /> }
leptos::mount_to_body(|| {
view! { <RootComponent /> }
});
}
2 changes: 1 addition & 1 deletion templates/simple_counter/web-yew/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2021"

[dependencies]
shared = { path = "../{{core_dir}}" }
yew = { version = "0.20.0", features = ["csr"] }
yew = { version = "0.21.0", features = ["csr"] }

0 comments on commit f7759b6

Please sign in to comment.