How do I show the loading status before the QR code comes out?
qingfengmy opened this issue · comments
qingfengmy commented
I have two modes, they show different QR codes, when switching, the QR code can not be switched immediately, before the new QR code comes out, I need to show the loading.
Paul O’Shannessy commented
This is generally a problem with React components. My advice would be to use the mode as a key when rendering, eg return <QRCodeCanvas key={mode} ... />
. This will force React to throw away the old instance rather than attempt to reuse it. This would be most useful for QRCodeCanvas, which will reuse the actual <canvas>
DOM node and does that outside of the render cycle.