Installation
To use the React SDK, you have to install both our vanilla JS SDK & our React SDK into your application. Client JS SDK:@onehop/client
React SDK: @onehop/react
npm
Yarn
Initializing the SDK
To use the React SDK within your app, you first must call theinit
method from
@onehop/client with your project ID. This should be done as early as possible in
your application’s lifecycle.
Find your project ID on this page.
JSX
With Next.js
If using Next.js (or SSR in general), then you need to make sure that the client gets initialized on the client-side, not the server. To do this, we recommend initializing the Hop Client in auseEffect
in your _app
file, for example:
JSX