Home Community Blog Buy Now

Misty Community Forum

lightClient and lightSocket to React?

I am just curious if it is possible to be able to convert the lightClient.js and lightSocket.js into a React app? Or if I would have to do something else for that (if any)?

to be clear, I assume that you are referring to lightClient.js and lightSocket.js in the MistyCommunity/REST-API repo.

lightSocket.js uses WebSocket and window of the host environment (e.g., a Web browser), and lightClient.js uses jQuery for $.ajax to make GET and POST requests. As such, both can be used in a React app without special consideration.

However, I do not think it is meaningful to say that lightSocket.js and lightClient.js can or cannot be “converted into a React app” because React is fundamentally about manipulating the DOM.

elaborating: if you have lightClient.js and lightSocket.js in another application that works with the DOM (for example, Roar.html), then you can entirely re-create it as a React app or read https://reactjs.org/docs/integrating-with-other-libraries.html