`NavProvider` useEffects teardown is trying to set `style` on an element that may not exist. The original code produces the following error:   Therefore, a condition has been added to check if `navRef.current` is truthy.