I am building a React Native game with multiple screens. I am trying to instantiate Ably one time and use it throughout the application without having to call new Ably('api-key')
on every screen, as this is creating multiple new connections and making it impossible to keep a single connectionId. Is there a way to architect this so that I can define
const client = new Ably('api-key')
one time in App.js
and use it throughout the other screens? Either by passing it as props through React Navigation props or using Context
? The documentation on this is sparse as most of their documentation only uses this on one page.