Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example on lazy rendering? #73

Open
thanhnguyen2187 opened this issue Jan 10, 2025 · 1 comment
Open

Example on lazy rendering? #73

thanhnguyen2187 opened this issue Jan 10, 2025 · 1 comment

Comments

@thanhnguyen2187
Copy link

Hi! Thanks a lot for the awesome library! Sorry for the noob question as I only started learning Rust a few weeks ago, but in the end, how should I define a lazy page? In more details, suppose I have this function to return an index page:

pub fn index(title: String, body: ?) -> ? {
    let template_fn = rsx! {
        <!DOCTYPE html>
        <html lang="en">
            <head>
                <meta charset="UTF-8">
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <meta http-equiv="X-UA-Compatible" content="ie=edge">
                <title>{title}</title>
                <link rel="stylesheet" href="https://matcha.mizu.sh/matcha.css">
            </head>
            <body>
                { /*how should I fill the body?*/ }
            </body>
        </html>
    };

    template_fn
}

Then I'm not really sure what should be returned

@vidhanio
Copy link
Owner

it should be impl Renderable. The code of my website may be useful as a sample on how to use the library. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants