Library for Webview IPC when using React #2864
hbmartin
started this conversation in
Extension Show and Tell
Replies: 1 comment
-
|
This is an excellent contribution to the VS Code extension ecosystem. I've reviewed your library and here are some professional insights: Strengths:
Suggested Enhancements:
Integration Example: // Extension side
import { createHost } from 'react-vscode-webview-ipc';
const host = createHost(vscode);
host.handle('getData', async (params) => {
return await vscode.workspace.findFiles(params.pattern);
});
// Webview React component
import { useVSCode } from 'react-vscode-webview-ipc';
function MyComponent() {
const { invoke } = useVSCode();
const [files, setFiles] = useState([]);
useEffect(() => {
invoke('getData', { pattern: '**/*.ts' }).then(setFiles);
}, []);
return <div>{files.length} files found</div>;
}This library fills a genuine gap in the VS Code extension development workflow. Consider adding comprehensive unit tests and documentation examples for complex use cases to further strengthen the project. |
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.
-
Hello! I've been working on a small library to ease Webview IPC when using React. Maybe someone will find this useful, would be great to get some critical feedback! https://github.com/hbmartin/react-vscode-webview-ipc
Beta Was this translation helpful? Give feedback.
All reactions