Refresh another component after an action
See original GitHub issueHi there, I would refresh a navbar component (Cart icon with total of elements inside it) when a product was added to the cart.
Anyone can help me figure out how to do it?
<!-- Component 1: Add to cart button -->
<form sprig s-method="post" s-action="commerce/cart/update-cart">
<input type="hidden" name="purchasableId" value="{{ variantId }}">
<button type="submit">Add to cart</button>
</form>
<!-- Component 2: Icon in the navbar with number of items in the cart -->
<div id="cart-icon">
{{ cart.lineItems|length }}
</div>
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
How to Refresh a Component in Angular - Stack Overflow
I'm struggling with refresh action in a component. I would like to refresh the router's components on button click. I have refresh button...
Read more >Refresh Angular Component Without Reloading The Same ...
If you are working with Angular and need to refresh a component without navigation on another component without using window.location.reload() or ...
Read more >Angular: Reload/Refresh a Component or Entire Application ...
An Angular tutorial on how to reload/refresh a single component or the entire application and reuse the logic across multiple components.
Read more >apex - How to refresh one component from another ...
Sometimes, you know that the cache is stale. If the cache is stale, the component needs fresh data. To query the server for...
Read more >Angular - How to refresh the component - YouTube
Angular tutorial. This is example how to refresh angular component using router0:00 Use case0:57 Solution3:37 Trying to learn pianoAngular ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Added a “Refreshing Components” recipe at https://putyourlightson.com/sprig-cookbook#refreshing-components.
Great!