You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Going to leave this open for a bit in case any one has better suggestions, or sees pitfalls in this method. Ideally would still like to initiate the connection on componentWillMount, but this will do for now.
Do not use componentWillMount. It runs on the server too.
You need to do this on the client, so use componentDidMount to start the connection.
Then use componentWillUnmount to close the connection.
Any recommendations on how to achieve a persistent connection between a Next app and an API.
Ideally, open the connection on
componentWillMount
and close the connection oncomponentWillUnmount
I have only found solutions that work either on the client (e.g.
XMLHttpRequest
) or the server (e.g.axios httpAgent
), but not universallyThe text was updated successfully, but these errors were encountered: