When StrictMode is enabled from React 18, unmount is called twice. unmount is called immediately after mount to overwrite the offset to 0 because the contextProvider feature saves the offset in unmount The unmount is called immediately after the mount, and the offset is overwritten to 0.
Therefore, saving the offset in context does not work.
When StrictMode is enabled from React 18, unmount is called twice. unmount is called immediately after mount to overwrite the offset to 0 because the contextProvider feature saves the offset in unmount The unmount is called immediately after the mount, and the offset is overwritten to 0.
Therefore, saving the offset in context does not work.