Reputation: 61
I just started learning yew (frontend framework). How do i put every component in separate file, like in js frameworks. (i am using function components now)
Upvotes: 2
Views: 810
Reputation: 61
Assuming you have a file like src/components/text.rs
, create a file called components.rs, and include the module like so:
pub mod Text;
Then, in main.rs, you can mod components;
allowing you to use Text elsewhere in your project with something like:
use crate::components::text::Text
Upvotes: 3