Closed jfpalacios closed 3 weeks ago
You can access the store programmatically with ds.store
.
Yes, but are there any directives or client side libraries to display a list of items from the store?
Not that I know of, besides looping over them. Maybe @delaneyj can confirm/deny?
are we talking about <div data-text="JSON.stringify(ctx.store(), null, 2)"></div>
?
No not exactly, something like alpine x-for :
<template x-for="post in posts">
<h2 x-text="post.title"></h2>
</template>
I realize this would usually be done on the backend but in some cases It would be useful to display some state on the client without sending the store on every request. Or if we were streaming store updates to the client and wanted to display these updates
no. but you can use webcomponents here to render that
Do not be afraid to go the server for your state. Embrace Hypermedia and don't accidentally recreate SPA on the frontend. If you truly have complicated state you can do as @blinkinglight says and make a webcomponent. Most likely you are over complicating it. I'm doing real-time daskboards and it's all backend drive.
I am trying to do some client side list manipulation before sending to the backend. I see I can update the ds store client side, but is there a way to display a list of items from the store dynamically on the client side?