sandpack
sandpack copied to clipboard
get no a sandboxId
Bug report
Packages affected
- [x] sandpack-client
- [ ] sandpack-react
Description of the problem
get no a sandboxId???
import {
SandpackPreview,
SandpackPreviewRef,
useSandpack,
} from "@codesandbox/sandpack-react";
import { useEffect, useRef } from "react";
interface SandPackPreviewClientProps {
isPreview: boolean;
}
const SandPackPreviewClient = ({ isPreview }: SandPackPreviewClientProps) => {
const previewRef = useRef<SandpackPreviewRef>(null);
const { sandpack } = useSandpack();
useEffect(() => {
console.log("previewRef.current", previewRef.current);
const client = previewRef.current?.getClient();
if (client) {
const clientId = previewRef.current?.clientId;
console.log("client", client, clientId);
console.log("sandpack", sandpack.clients, sandpack);
}
}, [sandpack]);
return (
<SandpackPreview
ref={previewRef}
style={{ height: "88vh" }}
showNavigator
/>
);
};
export default SandPackPreviewClient;