Skip to content

Commit 599a9a0

Browse files
committed
Check if section prop is defined
1 parent 7dba4a8 commit 599a9a0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/Section.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ class Section extends Component {
2727
}
2828

2929
componentDidMount() {
30-
this.viewedSection(get(this, 'props.section.id'))
3130
window.addEventListener('scroll', this.handleScroll)
32-
this.updateScrollPosition()
31+
32+
if (this.props.section) {
33+
this.viewedSection(this.props.section.id)
34+
this.updateScrollPosition()
35+
}
3336
}
3437

3538
componentWillUnmount() {

0 commit comments

Comments
 (0)