Adobe-Marketing-Cloud / target-atjs-extensions

Adobe Target extensions to at.js to support Single Page Application implementations
56 stars 29 forks source link

React component uses deprecated lifecycle methods #43

Open breeny opened 5 years ago

breeny commented 5 years ago

https://github.com/Adobe-Marketing-Cloud/target-atjs-extensions/blob/f689187eebf5cbbeabbcd76280907f5e68ce3a4f/react/component/src/component.jsx#L24-L26

As per the React documentation, componentWillReceiveProps is a deprecated method, slated for removal in v17.

One possible solution would be to change the implementation of shouldComponentUpdate and then leverage componentDidUpdate (I am aware of https://github.com/Adobe-Marketing-Cloud/target-atjs-extensions/issues/37 which may or may not make this possible).

Otherwise another option may be to trigger these side effects in the shouldComponentUpdate call, which seems like an anti pattern but is the first and only method that would be called if the implementation stays as returning false.