react-canvas-draw icon indicating copy to clipboard operation
react-canvas-draw copied to clipboard

Update props without refreshing

Open thekidchad opened this issue 5 years ago • 1 comments

Hi, Im looking for a solution to update props of react-canvas-draw realtime. I didnt find any solution to re-render the canvas.

For example : <CanvasDraw ref={(canvasDraw) => (this.saveableCanvas = canvasDraw)} brushColor={"#000"} brushRadius={1} hideGrid={() => this.setState({ hideGrid: true })} />

doesnt remove the grid in a realtime. May we need to rerender the canvasdraw ? How can we do it ?

Anybody has a solution ? Best regards

thekidchad avatar Jan 12 '21 16:01 thekidchad

Use the key prop from react,

key={`id-${showGrid}`}

that will force the component to re-render

lfdom avatar Apr 19 '21 03:04 lfdom