@mirohq/websdk-react-hooks
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "@mirohq/websdk-react-hooks", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Collection of React Hooks wrappers for Miro WebSDK", | ||
@@ -17,3 +17,3 @@ "main": "esm/index.js", | ||
"types": "lib/index.d.ts", | ||
"typings": "lib/indeqx.d.ts", | ||
"typings": "lib/index.d.ts", | ||
"scripts": { | ||
@@ -30,2 +30,3 @@ "start": "jest --watchAll --silent --coverage", | ||
"lint:types": "tsc --noEmit", | ||
"new-hook": "node ./utils/add-new-hook.mjs", | ||
"build:cjs": "tsc", | ||
@@ -37,2 +38,3 @@ "build:es": "tsc -m esNext --outDir esm", | ||
}, | ||
"license": "BSD-3-Clause", | ||
"husky": { | ||
@@ -39,0 +41,0 @@ "hooks": { |
@@ -35,8 +35,19 @@ # miro-websdk-react-hooks [![NPM version](https://img.shields.io/npm/v/@mirohq/websdk-react-hooks.svg)](https://www.npmjs.com/package/@mirohq/websdk-react-hooks) | ||
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 | ||
@@ -75,13 +86,2 @@ import dynamic from "next/dynamic"; | ||
## Hooks | ||
- [useMiro](https://github.com/miroapp/miro-react-hooks/tree/main/src/useMiro/useMiro.md) - Access Miro SDK reference from React Context. | ||
- [useCurrentUser](https://github.com/miroapp/miro-react-hooks/tree/main/src/useCurrentUser/useCurrentUser.md) - Get current [Miro user](https://developers.miro.com/docs/websdk-reference-board#getuserinfo). | ||
- [useInfo](https://github.com/miroapp/miro-react-hooks/tree/main/src/useInfo/useInfo.md) - Get [Miro board info](https://developers.miro.com/docs/websdk-reference-board#getinfo). | ||
- [useOnlineUsers](https://github.com/miroapp/miro-react-hooks/tree/main/src/useOnlineUsers/useOnlineUsers.md) - Get [online users](https://developers.miro.com/docs/websdk-reference-board#getonlineusers) in a Miro board. | ||
- [useSelectedItems](https://github.com/miroapp/miro-react-hooks/tree/main/src/useSelectedItems/useSelectedItems.md) - List [selected items](https://developers.miro.com/docs/websdk-reference-board#getselection) with possible predicate filter. | ||
- [useSession](https://github.com/miroapp/miro-react-hooks/tree/main/src/useSession/useSession.md) - Interact with [Miro session](https://developers.miro.com/docs/websdk-reference-session). | ||
- [useStorage](https://github.com/miroapp/miro-react-hooks/tree/main/src/useStorage/useStorage.md) - Interact with [Miro storage](https://developers.miro.com/docs/websdk-reference-storage). | ||
- [useViewport](https://github.com/miroapp/miro-react-hooks/tree/main/src/useViewport/useViewport.md) - Interact with [Miro viewport](https://developers.miro.com/docs/websdk-reference-viewport). | ||
## Built with | ||
@@ -97,4 +97,18 @@ | ||
> This library is heavily inspired on https://github.com/react-hookz/web. Pure :sparkling_heart: awesomeness :sparkling_heart:. | ||
## Contributing | ||
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide to get started. | ||
## Hooks | ||
- [useMiro](https://github.com/miroapp/miro-react-hooks/tree/main/src/useMiro.md) - Access Miro SDK reference from React Context. | ||
- [useCurrentUser](https://github.com/miroapp/miro-react-hooks/tree/main/src/useCurrentUser/useCurrentUser.md) - Get current [Miro user](https://developers.miro.com/docs/websdk-reference-board#getuserinfo). | ||
- [useInfo](https://github.com/miroapp/miro-react-hooks/tree/main/src/useInfo/useInfo.md) - Get [Miro board info](https://developers.miro.com/docs/websdk-reference-board#getinfo). | ||
- [useOnlineUsers](https://github.com/miroapp/miro-react-hooks/tree/main/src/useOnlineUsers/useOnlineUsers.md) - Get [online users](https://developers.miro.com/docs/websdk-reference-board#getonlineusers) in a Miro board. | ||
- [useSelectedItems](https://github.com/miroapp/miro-react-hooks/tree/main/src/useSelectedItems/useSelectedItems.md) - List [selected items](https://developers.miro.com/docs/websdk-reference-board#getselection) with possible predicate filter. | ||
- [useSession](https://github.com/miroapp/miro-react-hooks/tree/main/src/useSession/useSession.md) - Interact with [Miro session](https://developers.miro.com/docs/websdk-reference-session). | ||
- [useStorage](https://github.com/miroapp/miro-react-hooks/tree/main/src/useStorage/useStorage.md) - Interact with [Miro storage](https://developers.miro.com/docs/websdk-reference-storage). | ||
- [useViewport](https://github.com/miroapp/miro-react-hooks/tree/main/src/useViewport/useViewport.md) - Interact with [Miro viewport](https://developers.miro.com/docs/websdk-reference-viewport). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87140
112