React/NextJS: Fix a FreshDesk widget issue via TeamViwer/AnyDesk support

Job ID: 33440861

Budget: €30 – €250 EUR

Hello,

Please be aware the help needs to be done via team viewer or anyDesk as the project is too big to share and contains private elements which cannot be shared.

I have a problem with React/NextJS component I made recently.
I'm not an expert on React and working usually with pure backend so I have problems to understand how to fix it.

My issue is that I implemented a new component using the Script Component of NextJS to be able to show a FreshDesk widget on the pages of my application.

The problem is that is not working fully right giving an issue as described also here

https://stackoverflow.com/questions/71826832/nextjs-script-component-should-hide-on-a-specific-page/71826949#71826949

The issue as described is that the widget is showing or not showing when should it.
There is a problem with state mounting and I cannot resolve it.

The widget has not to be visible on the login page only but is it still doing it.

I tried to implement the useEffect but now when I refresh the page is not showing anymore the widget so I don't know how to solve it.

Thank you
Related categories: React.js Next.js