* Add readme for custom_components * Markdown link and consistent header style * Remove trailing space, consistent file name
Yew custom components demo
This example demonstrates how an application can be structured into components defined in separate modules, and how you can use callbacks to send messages to a component higher up in the hierarchy.
The components
lib.rs defines the root component, named Model. It constructs
Barrier and Counter elements, and passes them callbacks that send
messages back to Model. The lib module also brings the other components
into the project with mod statements at the top of the file.
button.rs defines a Button component with an onsignal
property. When the button is clicked, it generates an internal Clicked
message, which is handled in the update function by calling
self.onsignal.emit.
barrier.rs defines a Barrier which contains five
Buttons with identical behaviour. The Barrier has an onsignal property,
which is emitted if any of its child Buttons is clicked.
counter.rs defines a Counter component with several
attributes that can be set using props.