Skip to content

Organizing complex states for many different views #836

Answered by hecrj
randall-coding asked this question in Q&A
Discussion options

You must be logged in to vote

You probably do not need the state of all the different pages ready at once. I recommend you to use an enum to model the state of your pages. For instance:

mod home;
mod login;
mod account;

pub use home::Home;
pub use login::Login;
pub use account::Account;

pub enum Page {
    Home(Home),
    Login(Login),
    Account(Account),
    // ...
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by hecrj
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #832 on April 18, 2021 11:07.