@@ -550,18 +550,18 @@ This is the main painful breaking change. It applies to both element listeners a
550
550
551
551
Before :
552
552
```rust
553
- struct Model ;
553
+ struct MyComponent ;
554
554
555
555
enum Msg {
556
556
Click ,
557
557
}
558
558
559
- impl Component for Model {
559
+ impl Component for MyComponent {
560
560
type Message = Msg ;
561
561
type Properties = ();
562
562
563
563
fn create (_ : Self :: Properties , _ : ComponentLink <Self >) -> Self {
564
- Model
564
+ MyComponent
565
565
}
566
566
567
567
fn update (& mut self , msg : Self :: Message ) -> ShouldRender {
@@ -581,20 +581,20 @@ impl Component for Model {
581
581
582
582
After:
583
583
``` rust
584
- struct Model {
584
+ struct MyComponent {
585
585
link : ComponentLink <Self >,
586
586
}
587
587
588
588
enum Msg {
589
589
Click ,
590
590
}
591
591
592
- impl Component for Model {
592
+ impl Component for MyComponent {
593
593
type Message = Msg ;
594
594
type Properties = ();
595
595
596
596
fn create (_ : Self :: Properties , link : ComponentLink <Self >) -> Self {
597
- Model { link }
597
+ MyComponent { link }
598
598
}
599
599
600
600
fn update (& mut self , msg : Self :: Message ) -> ShouldRender {
@@ -653,7 +653,7 @@ was confusing and restrictive and is now a thing of the past!
653
653
654
654
Before:
655
655
``` rust
656
- impl Component for Model {
656
+ impl Component for MyComponent {
657
657
// ...
658
658
659
659
fn view (& self ) -> Html <Self > {
@@ -664,7 +664,7 @@ impl Component for Model {
664
664
665
665
After:
666
666
``` rust
667
- impl Component for Model {
667
+ impl Component for MyComponent {
668
668
// ...
669
669
670
670
fn view (& self ) -> Html {
@@ -688,20 +688,20 @@ cloned is when a wrapper component re-renders nested children components.
688
688
- The ` html! ` macro now accepts a ` Callback ` for element listeners. [[ @jstarry ] , [ #777 ] ( https://github.com/yewstack/yew/pull/777 )]
689
689
690
690
``` rust
691
- struct Model {
691
+ struct MyComponent {
692
692
onclick : Callback <ClickEvent >,
693
693
}
694
694
695
695
enum Msg {
696
696
Click ,
697
697
}
698
698
699
- impl Component for Model {
699
+ impl Component for MyComponent {
700
700
type Message = Msg ;
701
701
type Properties = ();
702
702
703
703
fn create (_ : Self :: Properties , link : ComponentLink <Self >) -> Self {
704
- Model {
704
+ MyComponent {
705
705
onclick : link . callback (| _ | Msg :: Click ),
706
706
}
707
707
}
@@ -875,20 +875,20 @@ cloned is when a wrapper component re-renders nested children components.
875
875
876
876
Before:
877
877
``` rust
878
- impl Component for Model {
878
+ impl Component for MyComponent {
879
879
type Message = Msg ;
880
880
type Properties = ();
881
881
882
882
fn create (_ : Self :: Properties , _ : ComponentLink <Self >) -> Self {
883
- Model {}
883
+ MyComponent {}
884
884
}
885
885
886
886
fn update (& mut self , msg : Self :: Message ) -> ShouldRender {
887
887
true
888
888
}
889
889
}
890
890
891
- impl Renderable <Model > for Model {
891
+ impl Renderable <MyComponent > for MyComponent {
892
892
fn view (& self ) -> Html <Self > {
893
893
html! { " hello" }
894
894
}
@@ -897,12 +897,12 @@ cloned is when a wrapper component re-renders nested children components.
897
897
898
898
After :
899
899
```rust
900
- impl Component for Model {
900
+ impl Component for MyComponent {
901
901
type Message = Msg ;
902
902
type Properties = ();
903
903
904
904
fn create (_ : Self :: Properties , _ : ComponentLink <Self >) -> Self {
905
- Model {}
905
+ MyComponent {}
906
906
}
907
907
908
908
fn update (& mut self , msg : Self :: Message ) -> ShouldRender {
0 commit comments