-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re export agora-rtc-sdk-ng methods from the React SDK #146
Comments
It may be achieved though, but there are 3 potential problems:
|
I agree with the problems you mentioned but we're targeting to release this is as a standalone SDK, we can't position this as a dependency on the Web SDK or a wrapper. So even though the concerns you mentioned are valid, we'll have to find the best course for release
|
Hey sorry for the wait on this. Discussing internally if we should mix both named exports and default export in the same package. This isn't considered a good practice as of late, but it follows more of the Web SDK pattern of exports so I'm torn. Which do you think is better? import AgoraRTC, {useClientHook, ...} from "agora-rtc-react" vs. import {AgoraRTC, useClientHook, ...} from "agora-rtc-react" |
I think we should use import {AgoraRTC, useClientHook, ...} from "agora-rtc-react" In case of export the default class AgoraRTCReact in the future, or we should consider (need websdk help here) export class AgoraRTCReact extends AgoraRTC {} usage: import AgoraRTCReact from "agora-rtc-react" And there is more thing, CDN is umd package , window is prefer to export AgoraRTCReact instead of AgoraRTC |
If we re-export Web SDK from React, another detail to discuss would be how we keep the Web SDK peer dependency up to date. We'll need to make sure that minor updates to the Web SDK don't require an update to the React SDK. New installs of the React SDK should get the latest releases of both (as long as Web SDK follows semantic versioning/backwards compatibility). This shouldn't be difficult to do, just something to keep in mind when we make this change. |
Argument against default exports: https://x.com/kentcdodds/status/1702339919438627290 |
@EkaanshArora I did some for this feature, #163 import type { ILocalAudioTrack, ILocalTrack, ILocalVideoTrack } from "agora-rtc-react";
import AgoraRTC, {
AgoraRTCScreenShareProvider,
LocalAudioTrack,
LocalVideoTrack,
useJoin,
usePublish,
useTrackEvent,
} from "agora-rtc-react"; And window object (only in umd/iife) Let me know if you have another ideas. |
Hey this looks good, let me give it a try and get back to you! |
completed in #163 |
What kind of problem does this feature solve?
Since we're positioning the React SDK as a standalone product. We should re-export all the exports from the web sdk. This is important as while using the React SDK the devs also need to access exports from Web like types, default export, enums etc.
What does the proposed API look like?
Open to discuss if we should avoid a default export.
The text was updated successfully, but these errors were encountered: