Skip to content

Commit

Permalink
Replace deprecated calll to UNSAFE_componentWillReceiveProps
Browse files Browse the repository at this point in the history
Merging makotot#162
  • Loading branch information
csrudolflai committed Dec 18, 2020
1 parent 71d8388 commit 8dae3ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/js/lib/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ export default class Scrollspy extends React.Component {
throttle(this._spy(), 100)
}

_initFromProps () {
const targetItems = this._initSpyTarget(this.props.items)
_initFromProps (props) {
const targetItems = this._initSpyTarget(props.items)

this.setState({
targetItems,
Expand All @@ -235,16 +235,16 @@ export default class Scrollspy extends React.Component {
}

componentDidMount () {
this._initFromProps()
this._initFromProps(this.props)
this.onEvent()
}

componentWillUnmount () {
this.offEvent()
}

UNSAFE_componentWillReceiveProps () {
this._initFromProps()
getDerivedStateFromProps (props) {
this._initFromProps(props)
}

render () {
Expand Down

0 comments on commit 8dae3ec

Please sign in to comment.