lucky-canvas icon indicating copy to clipboard operation
lucky-canvas copied to clipboard

<React.StrictMode> 这个模式下 myLucky.current?.play() 不生效

Open INTKILOW opened this issue 1 year ago • 2 comments

react 18

const myLucky = useRef() myLucky.current = new LuckyWheel('#my-lucky' as any, {})

<React.StrictMode> 这个模式下useEffect 进入了两次,调用 myLucky.current?.play() 不生效但是能打出来引用

INTKILOW avatar Mar 06 '23 08:03 INTKILOW

你用的该不会是老版本吧, 之前这个问题解决过

buuing avatar Mar 22 '23 02:03 buuing

https://github.com/buuing/lucky-canvas/issues/309

和这个类似,应该是创建了两个canvas

cathats avatar Apr 12 '23 01:04 cathats