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:
bors[bot] 2019-08-04 01:34:55 +00:00
commit fea73fe941

View File

@ -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`