Use of UseEffect in React App

Hi Freshdesk,

I have used UseEffect in my app but it doesn’t seems to work, unlike normal component with no useEffect and not so large codes like the demo component comes with “fdk create --products freshdesk --template your_first_react_app” are being rendered, even mine also render if I don’t use any useEffect in it.

for Eg. just see below

Now this component is rendered but if I use something like,

Now this is a snippet of the component I am building and it uses useEffect also unlike previous screenshot it do not render simple “h1” tag rather render some QR code data which I cannot share but I hope you understand my point.

Hi @arishti_plugin_dev ,

Good day!

This doesn’t look like problem with usage of useEffect (or) large code as you mentioned above. UseEffect should work fine & I’m attaching a simple app which hits a dummy api & displays the results as a list.

Please unzip & check this sample provided.

Most probably, the issue should be on your socket connectivity part. Since you don’t have much template part in your screenshot & your socket backend is using localhost (say, if fails) you would find a blank page.

react-test.zip (348.8 KB)

Hope this helps!

Thanks for the reply but I have tried rendering the App which you provided and it only renders the text or image file but if I tried to change the React code according to the components we have designed, connect sockets in my backend to the react frontend it will suddenly show a large no. of requests in the network section of browser, also I have tried one app previously where I connected my socket backend with html only frontend and it works.

Now when I do the same things here, it is not working.

Now in this image if you see we are connecting our socket backend and it is getting connected if I open my React localhost in browser(showing that console which is to be called when we connect) but when I did the same thing on freshdesk it is not being able to connect.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.