mirror of
https://github.com/yewstack/yew.git
synced 2026-02-01 17:26:28 +00:00
Merge #554
554: Change Component trait change method to default true r=jstarry a=jstarry Fixes https://github.com/DenisKolodin/yew/issues/538 Co-authored-by: Justin Starry <jstarry@users.noreply.github.com>
This commit is contained in:
commit
fea73fe941
@ -29,9 +29,10 @@ pub trait Component: Sized + 'static {
|
||||
/// Called everytime when a messages of `Msg` type received. It also takes a
|
||||
/// reference to a context.
|
||||
fn update(&mut self, msg: Self::Message) -> ShouldRender;
|
||||
/// This method called when properties changes, and once when component created.
|
||||
/// This method called when properties changes, and once when component created. It defaults
|
||||
/// to true if not implemented.
|
||||
fn change(&mut self, _: Self::Properties) -> ShouldRender {
|
||||
unimplemented!("you should implement `change` method for a component with properties")
|
||||
true
|
||||
}
|
||||
/// Called for finalization on the final point of the component's lifetime.
|
||||
fn destroy(&mut self) {} // TODO Replace with `Drop`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user