Hi Team,
Is there a way to share the data between components without using model class or servlet ?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @JakeCham
It totally depends on the use case:
Case I:
For sharing the data between the component if your use case is with that the component can be CSR (client side rendered), then in that case you can create the WebComponent with the libraries using as React, etc which manages the state.
Using the webpack or gulp then you can create the minified javascript for the same. Once the javascript file is created use this along with the clientlibs for your existing site.
Now as this is a web component and it is CSR, so your should be able to pass the data within.
Case II:
If your components are totally based on the HTL/Sightly then javascript has to be written to read the data or write the data directly in to the DOM or one can use the input hidden values for achieving this.
Hope this helps!
Thanks
Yes, you can but it depends on the use case.
Could you please explain use case here?
Hi @JakeCham
It totally depends on the use case:
Case I:
For sharing the data between the component if your use case is with that the component can be CSR (client side rendered), then in that case you can create the WebComponent with the libraries using as React, etc which manages the state.
Using the webpack or gulp then you can create the minified javascript for the same. Once the javascript file is created use this along with the clientlibs for your existing site.
Now as this is a web component and it is CSR, so your should be able to pass the data within.
Case II:
If your components are totally based on the HTL/Sightly then javascript has to be written to read the data or write the data directly in to the DOM or one can use the input hidden values for achieving this.
Hope this helps!
Thanks
Views
Likes
Replies