Replies: 1 comment
-
Hey @imcuttle! Interesting question. import { useSandpack } from "@codesandbox/sandpack-react";
const CustomListener = () => {
const { sandpack, listen } = useSandpack();
useEffect(() => {
// listens for any message dispatched between sandpack and the bundler
const stopListening = listen((msg) => console.log(msg));
// update file
sandpack.updateFile(path, newCode)
return () => {
// unsubscribe
stopListening();
};
}, [listen]);
return null
}; Docs reference:
Hope it makes sense for you. Otherwise, please let me know that I'll be glad to make it work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How to implements some low code feature(like drag and drop component to preview for update code)
Should I build myself codesandbox-client code, for preview iframe communicates with parent window?
Beta Was this translation helpful? Give feedback.
All reactions