-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When the <SpacesProvider> React component is used, most of the time, the spaces object needs to be created first.
From the documentation:
const ably = new Realtime.Promise({ key: "VS4Rww.ijkxYg:*****", clientId: 'clemons' });
const spaces = new Spaces(ably);
root.render(
<SpacesProvider client={spaces}>
<SpaceProvider name="my-space">
<App />
</SpaceProvider>
</SpacesProvider>
)It would be nice if, alternatively to the spaces object, the key and the clientId could be passed to the SpacesProvider and the SpacesProvider cares about initializing Ably and Spaces:
<SpacesProvider key="VS4Rww.ijkxYg:*****" clientId="clemons">
<SpaceProvider name="my-space">
<App />
</SpaceProvider>
</SpacesProvider>Or alternatively have an object, which is passed to Realtime.Promise().
This would save some boilerplate code and also would make sure that implementers don't have to remember to put the Spaces initialization into a useMemo()/ useEffect() hook ;)
pchr-srf
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request