From 7ff8bc7ce1023978f2a07ef9d890183d0d655b73 Mon Sep 17 00:00:00 2001 From: Mettin Parzinski Date: Mon, 11 Dec 2023 09:06:53 +0100 Subject: [PATCH] Update README.md --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce35a0b..7ea5a93 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,22 @@ Make sure you have a [Miro application](https://developers.miro.com/docs/build-y ### Isomorphic or not? -The [Miro WebSDK](https://developers.miro.com/docs/miro-web-sdk-introduction) is **NOT** isomorphic, meaning that you cannot use it in both server and client environments. This also applies to this library, it won't work you are rendereing your React components in the server. +The [Miro WebSDK](https://developers.miro.com/docs/miro-web-sdk-introduction) is **NOT** isomorphic, meaning that you cannot use it in both server and client environments. This also applies to this library, it won't work wehn you are rendereing your React components in the server. ### What if I am using Nextjs? -Well, in that case, you can wrap your component in a dynamic code block that will defer the component rendering to only execute in the client-side: +#### Using app router +Just make sure that the component that uses the hooks is only rendered on the client by using the `use client` directive on top of your component. +```tsx +'use client' +import { useCurrentUser } from "@mirohq/websdk-react-hooks"; + +// Your component +``` + + +#### Using pages router +Wrap your component in a dynamic code block that will defer the component rendering to only execute in the client-side: ```tsx import dynamic from "next/dynamic";