eudrino
eudrino
SSolidJS
Created by eudrino on 11/9/2023 in #support
Cache dom elements with router
I'm trying to cache dom elements between route changes with @solidjs/router where instead of recreating dom elements between route changes, instead i use pre-created ones i tried using
const home = <Home />;
<Route path="/" component={() => home} />
const home = <Home />;
<Route path="/" component={() => home} />
instead of
<Route path="/" component={Home} />
<Route path="/" component={Home} />
but it prevents me from using the <A> tag to link between pages client-side is there a better way to introduce caching of dom elements?
7 replies
SSolidJS
Created by eudrino on 4/9/2023 in #support
DOM nodes caching for faster swap
Hello, i'm trying to cache dom nodes between updates (i have 2 div elements with 200 child nodes each, and i want to swap between them without recloning the <template> element, is there an idiomatic way to do that?) I also tried to store the 2 div elements in an array and swap like this <div>{array[activeParent()]}</div> and update the children using array[1].append(<div />) for example, but i wondered if there's a downside to that (memory leak, update bugs, worse performance)
4 replies