Advanced
Running both V1 and V2 of the SDK
How to set up Frigade in your React app if you’re already using V1 and want to start using V2
If you already have a V1 implementation and aren’t ready to fully upgrade yet, you can use both V1 and V2 at the same time.
First, install V2 using a package alias:
"dependencies": [
"@frigade/react": "1.x",
"@frigade/reactv2": "npm:@frigade/react@2.x",
]
Then add the V2 Provider
above the V1 FrigadeProvider
:
import { FrigadeProvider } from "@frigade/react";
import * as Frigade from "@frigade/reactv2";
const FRIGADE_API_KEY = "api_public_abcd1234";
export const App = () => {
const userId = "...";
return (
<Frigade.Provider apiKey={FRIGADE_API_KEY} userId={userId}>
<FrigadeProvider publicApiKey={FRIGADE_API_KEY} userId={userId}>
{/* ... */}
</FrigadeProvider>
</Frigade.Provider>
);
};
With this setup you can import V1 components from @frigade/react
and V2 components from @frigade/reactv2
.