React compoent to use canvas
npm i react-canvas-sign
import { useRef } from "react";
import "./App.css";
import Canvas from "react-canvas-sign";
// import Canvas from "../dist/react-canvas.es";
function App() {
const canvasRef = useRef(null);
return (
<div className="App">
<Canvas
ref={canvasRef}
height={400}
width={800}
contextProps={{}}
></Canvas>
</div>
);
}
export default App;
prop | type | default |
---|---|---|
contextProps | object |
|
width | number |
|
height | number |
|
className | string |
props | desc |
---|---|
canvasRef | canvas ref |
undo() | undo operation |
clear() | clear operation |
save() | save as png image |