Amy Blankenship
Jul 15, 2022

--

Funny you should mention that. I just finished doing a Websocket implementation loosely based on this https://redux.js.org/tutorials/essentials/part-8-rtk-query-advanced#streaming-cache-updates that automatically sets up the websocket connection and routes updates from the socket to the various parts of the Redux states. So the Views are not at all involved in the websocket--they have no references to it or knowledge it exists. They _are_ getting this from useSelector hook, but that's because I'm gradually untangling a bunch of hooks spaghetti, and once you get to the point where you're just using the output of a hook "as is" and not doing a bunch of useEffect round robins, that's "good enough."

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (1)