In strict mode, react 18 runs effects twice before updating useState state, which was causing the viewer initialization to happen twice. storing the instance in a ref fixes this by updating the reference immediately inside the useEffect.
As far as I know the instance doesn't need to be reactive so useState is unnecessary.
fixes #20
In strict mode, react 18 runs effects twice before updating useState state, which was causing the viewer initialization to happen twice. storing the instance in a ref fixes this by updating the reference immediately inside the useEffect.
As far as I know the instance doesn't need to be reactive so useState is unnecessary.