Client logic in SSR
Learn how to use client-side methods in server-rendered code.
The methods exposed by the useCroct hook only run on the client. Calling one while the component renders on the server throws an error like the one below:
Error
Property croct.someMethod is not supported on server-side (SSR). Consider refactoring the logic as a side-effect (useEffect) or a client-side callback (onClick, onChange, etc).
Call these methods from a useEffect hook or an event handler such as onClick or onChange, so they run after hydration.
For server-side operations, use the server functions from a loader or action instead: fetch content with fetchContent, evaluate queries with evaluate, and manage identity with identify and anonymize.