The documentation shows how ResClient can be implemented with class component in react, anyone know how it can be implemented with functional components?
1 Like
I have an npm package that exports our resgate client functionality,
I export the client, refresh and logout methods.
refresh returns a promise which we use in the useEffect hook, it refreshes the token then does any setup needed for the component.
each of our pages are standalone and setup the connection on each page navigation. My next evolution is to move the client into a shared worker so we don’t have to connect on each page change.
Of course I could build a mono app frontend and only connect 1 times, but I really prefer the workflow of self contained pages, plus it eliminates all the complexity of using the router and history.
1 Like