@koala-live/react
Koala SDK hooks for React.
Install
yarn add @koala-live/react
yarn add react react-dom
Usage
import React from "react";
import ReactDOM from "react-dom";
import { KoalaProvider, useKoala } from "@koala-live/react";
function App() {
const { koala, ready } = useKoala();
const user = useCurrentUser();
React.useEffect(() => {
if (user) {
koala.identify({ email: user.email, name: user.name });
}
}, [koala, user]);
return <div>{ready ? "Ready" : "Loading"}</div>;
}
ReactDOM.render(
<KoalaProvider project="<your Koala project slug>">
<App />
</KoalaProvider>,
document.getElementById("root")
);