Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump wasm-bindgen, yew, rust && migrate from a struct based component to a functional component #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[package]
authors = [
"Kelly Thomas Kline <kellytk@sw-e.org>",
"Samuel Rounce <me@samuelrounce.co.uk>"
"Samuel Rounce <me@samuelrounce.co.uk>",
"Mahmoud Harmouch <oss@wiseai.dev>"
]
categories = ["gui", "wasm", "web-programming"]
description = "yew-wasm-pack-minimal demonstrates the minimum code and tooling necessary for a frontend web app with simple deployable artifacts consisting of one HTML file, one JavaScript file, and one WebAssembly file, using Yew, wasm-bindgen, and wasm-pack."
edition = "2018"
edition = "2021"
keywords = ["yew", "wasm", "wasm-bindgen", "web"]
license = "MIT/Apache-2.0"
name = "yew-wasm-pack-minimal"
readme = "README.md"
repository = "https://github.com/yewstack/yew-wasm-pack-minimal"
version = "0.1.0"
version = "0.1.1"

[lib]
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "^0.2"
yew = "0.17"
wasm-bindgen = "0.2.87"
yew = { version = "0.21.0", features = ["csr"] }
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 {{authors}}
Copyright (c) 2023 Yew Stack Core Team

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
edition = "2018"
edition = "2021"
28 changes: 4 additions & 24 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
use yew::prelude::*;

pub struct App {}

pub enum Msg {}

impl Component for App {
type Message = Msg;
type Properties = ();

fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
App {}
}

fn update(&mut self, _msg: Self::Message) -> ShouldRender {
true
}

fn change(&mut self, _: Self::Properties) -> ShouldRender {
false
}

fn view(&self) -> Html {
html! {
<p>{ "Hello world!" }</p>
}
#[function_component(App)]
pub fn app() -> Html {
html! {
<p>{ "Hello world!" }</p>
}
}
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ mod app;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn run_app() -> Result<(), JsValue> {
yew::start_app::<app::App>();

Ok(())
pub fn run_app() {
yew::Renderer::<app::App>::new().render();
}