aboutsummaryrefslogtreecommitdiff
path: root/cookbook-render/src/lib.rs
#![recursion_limit = "256"]

use yew::{Component, ComponentLink, Html, ShouldRender};

pub struct Main {
    link: ComponentLink<Self>,
    value: i64,
}

pub enum Msg {
    Incr,
    Decr,
}

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

    fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self {
        Self { link, value: 0 }
    }

    fn update(&mut self, msg: Self::Message) -> ShouldRender {
        match msg {
            Msg::Incr => self.value += 1,
            Msg::Decr => self.value -= 1,
        }

        true
    }

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

    fn view(&self) -> Html {
        todo!()
    }
}