最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rust - how to store data with leptos - Stack Overflow

programmeradmin0浏览0评论

I have a json file in my assets that contains a basic json like

{
   "name": "hello"
}

I have a method to load this file with serde_json and I would like to display the content of this file in a [component]. Ideally I don't want to reload this file at every re-render. I have something like this in mind :

#[component]
pub fn Display() -> impl IntoView {
    let data = StoredValue::new(load_json());

    view! {
        <p>
            { data.name }
        </p>
    }
}

But I can't make it work.

发布评论

评论列表(0)

  1. 暂无评论