@turnkey/sdk-react
is our legacy React SDK, which is still available for use but is not recommended for new projects. It is built off @turnkey/sdk-browser
and provides direct integration with Turnkey’s API into React applications.
This package will soon be discontinued, if you’re starting a new project, we recommend using the @turnkey/react-wallet-kit
instead.
@turnkey/sdk-react
package wraps the functionality from the @turnkey/sdk-browser
package to allow developers to build React-based applications that interact with the Turnkey API with different types of authentication.
It allows developers to use the same clients exposed in @turnkey/sdk-browser
that enable requests to the API authenticated via different auth methods powered by passkeys or user sessions (using iframes). It also contains the same methods to manage information and state related to authentication like auth bundles and sessions, retrieving user information and server signing API requests.
Use the @turnkey/sdk-react
package when you’re building React-based frontend applications that interact with the Turnkey API.
App.tsx
(or equivalent file)
window.location.hostname
unless otherwise specified)serverSign
flow@turnkey/sdk-react
is a package that provides abstractions on top of the @turnkey/sdk-browser
package, for usage in React-based applications.
In any React component nested under the TurnkeyProvider
, you’ll be able to call useTurnkey()
as in the following example. You can also instantiate clients like passkeyClient
and indexedDbClient
by pulling them out of the provider directly as such.
@turnkey/sdk-react
package, check out our Code Examples section.