I have e-commerce based page. The entire page is not wrapped within a single react app.
The bulk of the page's static content is rendered on the server-side using EJS. Upon rendering on the client we initialize two isolated react apps with their own states.
- Cart App. (Shows a count representing items count in the cart)
- Product list app - The product list app renders a list of products.
Each product item has an Add to Cart button. When the user clicks on it we need to immediately update the count in the cart without refreshing the page.
Now the question I have is if there is a way to achieve this without rendering the entire page in react. Below is the rough HTML markup I have.
<navbar>
<navbar-links/>
<div id="site-cart-app"></div> // this is where the cart react app is initialized.
</navbar>
<div id="product-list-app"></div> // this is where the product list app is initialized.
you can use common redux store to maintain the cart count, both Apps will use that store