react-moment icon indicating copy to clipboard operation
react-moment copied to clipboard

Deprecation warning: React 16.9.0 +

Open swathisainadh opened this issue 5 years ago • 8 comments

Hi,

This library works great for my basic requirement of formatting a given date and timezone. But it's just that I have warning from React 16.9.0 for componentWillMount and componentWillReceiveProps. Is there any ongoing work happening to support the React Hooks version in near future?

react-dom.development.js:11963 Warning: componentWillMount is deprecated and will be removed in the next major version. Use componentDidMount instead. As a temporary workaround, you can rename to UNSAFE_componentWillMount. Warning: componentWillReceiveProps is deprecated and will be removed in the next major version. Use static getDerivedStateFromProps instead.

"moment": "^2.24.0", "moment-timezone": "^0.5.25", "react-moment": "^0.9.2"

"react": "^16.9.0-alpha.0", "react-dom": "^16.9.0-alpha.0",

swathisainadh avatar Jun 06 '19 02:06 swathisainadh

Thanks for the feedback. Some simple rewriting can resolve those problems. I'll get on that shortly. I don't have any immediate plans to use hooks. As written, react-moment is very much a class based component and I can't think of any value hooks bring to the table.

headzoo avatar Jun 08 '19 02:06 headzoo

Thanks for the feedback. Some simple rewriting can resolve those problems. I'll get on that shortly. I don't have any immediate plans to use hooks. As written, react-moment is very much a class based component and I can't think of any value hooks bring to the table.

thanks in advance @headzoo the console warnings are just kicking me off. Did a quick resolve on myself until your update arrives.

Maetes avatar Aug 13 '19 12:08 Maetes

@headzoo maybe we can have just quickfix for now with renaming those methods to eliminate warnings? Anyway some day react will move forward and this lib probably too right?

egemon avatar Aug 16 '19 12:08 egemon

@egemon i just have created a pull request #99 . Have a look whether this solves your issue for now.

Maetes avatar Aug 17 '19 10:08 Maetes

Any updates on getting this merged @headzoo ?

amcdnl avatar Sep 03 '19 23:09 amcdnl

Is there any updates on this?

ghost avatar Oct 26 '19 01:10 ghost

I believe this was handled in https://github.com/headzoo/react-moment/pull/102. The most recent version doesn't use componentWillMount.

headzoo avatar Oct 26 '19 01:10 headzoo

oddly I am still getting the error when using react moment... 0.9.7 is installed which is after the merge you mentioned. Going to try and track it down.

voglster avatar Apr 14 '20 20:04 voglster