Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@mirohq/websdk-react-hooks
Advanced tools
Collection of React hooks to interact with Miro Platform WebSDK.
Add a bit of :sparkles:reactivity:sparkles: to your Miro app.
$ npm install @mirohq/websdk-react-hooks
// or
$ yarn add @mirohq/websdk-react-hooks
Wrap your components with MiroProvider and inject the global instance of Miro WebSDK.
import { MiroProvider } from "@mirohq/websdk-react-hooks";
const App: React.FC = ({ children }) => <MiroProvider>{children}</MiroProvider>;
/*
You can also optional inject the global Miro WebSDK instance
const App: React.FC = ({ children }) => <MiroProvider miro={window.miro}>{children}</MiroProvider>;
*/
Make sure you have a Miro application configured to use it. The hooks in this library will only work within Miro boards and in a well-configured app.
The Miro WebSDK 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.
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.
'use client'
import { useCurrentUser } from "@mirohq/websdk-react-hooks";
// Your component
Wrap your component in a dynamic code block that will defer the component rendering to only execute in the client-side:
import dynamic from "next/dynamic";
import React from "react";
import { useCurrentUser } from "@mirohq/websdk-react-hooks";
const NoSsr: React.FC<React.PropsWithChildren> = (props) => (
<React.Fragment>{props.children}</React.Fragment>
);
const NoSSRWrapper = dynamic(() => Promise.resolve(NoSsr), {
ssr: false,
});
// And in your Nextjs page
const Component: React.FC = () => {
const { status, result, error } = useCurrentUser();
if (status === "success") {
return <p>The current user is "{result?.name}"</p>;
}
}
export default function OnlyInTheClient() {
return (
<NoSSRWrapper>
<Group />
</NoSSRWrapper>
);
}
This library is heavily inspired on https://github.com/react-hookz/web. Pure :sparkling_heart: awesomeness :sparkling_heart:.
Please refer to the CONTRIBUTING.md guide to get started.
FAQs
Collection of React Hooks wrappers for Miro WebSDK
The npm package @mirohq/websdk-react-hooks receives a total of 0 weekly downloads. As such, @mirohq/websdk-react-hooks popularity was classified as not popular.
We found that @mirohq/websdk-react-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.