Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Is this really React? #52

Closed
pmvald opened this issue Aug 22, 2021 · 3 comments
Closed

Is this really React? #52

pmvald opened this issue Aug 22, 2021 · 3 comments

Comments

@pmvald
Copy link

pmvald commented Aug 22, 2021

Reading the source code, I see that it does nothing but loading another js file (tracking.js) as a script to the page, and then this script adds html elements to the page to show the chat stuff. But this direct manipulation of the DOM is somehow against the react principal (?!). To make it really react, the whole chat frontend stuff (including the element generating code in tracking.js) should either become a react component, or a web component (that renders into the shadow DOM). The present implementation is not react.

@biswajeet-cn
Copy link

Agreed, the current code is not following react in any way.

@pmvald
Copy link
Author

pmvald commented Aug 27, 2021

If we assume that all react frameworks/toolchains (create-react-app, gatsby, nextjs, etc) render the react stuff in a certain div element within the body, and assuming that this code (or better to say the tracking.js code) creates its element in a div right before the body, then there might be no conflict. But all these assumptions are just assumptions ... the safest way is that the chat stuff are rendered in a shadow DOM through some web component. Then there would be 100% no conflict with neither react nor any web component framework. The key is to avoid light DOM

@walaszczykm
Copy link
Collaborator

Hello 👋

I am happy to say that we have created a new set of packages to support more frontend frameworks integration with LiveChat Chat Widget: Chat Widget Adapters 🙂

Nor this repository nor the new one was never meant to provide a full implementation of the LiveChat Chat Widget for certain frameworks. The application is built and distributed by our company in form of installable widgets for websites and web apps and hosted from CDN. This and the new project of Chat Widget Adapters allow for easier integration in the project using certain frontend technologies as opposite to integrating it via HTML snippet code and Vanilla JS interactions with CW JS API.

We are more than eager to hear the feedback from you about the new implementation 🙌

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants