I’m trying to integrate WeatherWidget.io into a React/NextJS app.
This isn’t a react component, and in order to integrate it you have to copy paste a
<a> and a
By using the NextJS
<Head> component (equivalent to ReactHelmet), it renders properly server side, however, once the first client side update is triggered, the component disappears.
I’ve tried using
dangerouslySetInnerHTML, or manually creating a script tag in
ComponentDidMount, but it didn’t work.
Do you have any best practice for this scenario? I’ve also tried to avoid the component to re-render, but setting
shouldComponentUpdate to false doesn’t work either (I would have to get to Component completely out of the render tree, and it’s not possible).
Try the following:
scripttag of the widget at the bottom of your HTML page.
atag in a component.
In the componentDidMount method of that component add the following code: