Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider @y-sweet/react re-exporting ClientToken type #129

Open
colelawrence opened this issue Sep 15, 2023 · 3 comments
Open

Consider @y-sweet/react re-exporting ClientToken type #129

colelawrence opened this issue Sep 15, 2023 · 3 comments

Comments

@colelawrence
Copy link

I think it would make sense to export this type, so I can do a const token = useMemo((): ClientToken => ({ ... }), [...]) in my provider.

I can work around this by also adding the sdk package & importing the type from there.

@colelawrence
Copy link
Author

Ah-ha. I see that I need to import getClientToken to create this string. I missed that. Sorry!

@colelawrence
Copy link
Author

So, perhaps it needs to be added to the docs as another requirement
https://y-sweet.dev/js/react

In an existing Next.js or React app, install @y-sweet/react as follows:
npm i @y-sweet/react

A different thing I tried was using the ys:// link from y-sweet serve as a value in the ClientToken type. Maybe there's an opportunity for a defensive check and throw for the end-user.

@paulgb
Copy link
Member

paulgb commented Sep 15, 2023

Thanks Cole. I like the idea of adding the defensive check.

And I do think it makes sense to expose ClientToken from @y-sweet/react. We’re currently refactoring the Vanilla JS client out of the React lib to better support non-React frameworks (#128), so I'll aim to re-export ClientToken either as part of that refactor or once the dust settles on it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants