Skip to content

Commit

Permalink
fix: now correctly removing activeClass on update
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudPower97 committed Dec 3, 2018
1 parent c3aeeb3 commit 10ae785
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 10ae785

Please sign in to comment.