diff --git a/src/Scrollspy.js b/src/Scrollspy.js index 200d309..b127225 100644 --- a/src/Scrollspy.js +++ b/src/Scrollspy.js @@ -97,8 +97,10 @@ export default class Scrollspy extends Component { const { navItems } = this.state const { activeClass } = this.props - const active = navItems.find(navItem => navItem.classList.contains(activeClass)) - active && active.classList.remove(activeClass) + if (navItems) { + const active = navItems.find(navItem => navItem.classList.contains(activeClass)) + active && active.classList.remove(activeClass) + } } render() {