Features
add useWasm
Hook π
import { useWasm } from "react-wasm";
// supposing an "add.wasm" module that exports a single function "add"
const ExampleComponent = () => {
const {
loading,
error,
data
} = useWasm({
url: '/add.wasm'
});
if (loading) return "Loading...";
if (error) return "An error has occurred";
const { module, instance } = data;
return <div>1 + 2 = {instance.exports.add(1, 2)}</div>;
};
Breaking changes
- react-wasm now needs
react@^16.8.0
- dropped
node@9
support