react-lifecycle-methods-diagram icon indicating copy to clipboard operation
react-lifecycle-methods-diagram copied to clipboard

Add hooks lifecycle

Open EricCoteReact opened this issue 5 years ago • 6 comments

This is to add the hooks lifecycle. This is inspired by: https://github.com/donavon/hook-flow (which was approved by Dan Abramov)

https://www.ReactAcademy.ca is distributing this as a handout to students, so I thought it would be cool to give back to the community.

This will wreck the translation, since I added a few strings. But I thought it would be worth it.

EricCoteReact avatar Nov 12 '19 21:11 EricCoteReact

Wow, that's quite something! Thank you!

The only thing I don't like is our version switcher. It doesn't make sense anymore. I need to give i a thought how to do it.

Perhaps under version switcher, after we choose ^16.8, there could be tabs showing two diagrams: lifecycle methods and hooks? 🤔

wojtekmaj avatar Nov 13 '19 14:11 wojtekmaj

As you saw, I just "squashed" a few commits together.

A lot of the "unrelated" changes (line separators, etc) were "forced" on the code because I'm using the Prettier extension on VS Code. (Thanks for cleaning that out!)

You are right, the version picker is kind of obsolete.

This is my take: The three unsafe lifecycle methods: componentWillMount componentWillReceiveProps componentWillUpdate

These are still part of React 16.2. They were only marked as UNSAFE from React 16.3.

Also, getDerivedStateFromProps was only introduced from 16.3, and "bugfixed" in 16.4.

https://reactjs.org/blog/2018/05/23/react-v-16-4.html#bugfix-for-getderivedstatefromprops

I would not document something that is now considered a "bug" from version 16.3.

We aren't documenting the old unsafe Methods from 16.2. Why should we do the same with a bug from 16.3?

Also, that bug was fixed rapidly. Between version 16.3 and 16.4, there's only 55 days. Not even two months. And it's been more than a year that it has been fixed.

So that means that the version "picker" could now simply be "class lifecycle" and "hooks lifecycle". Let's just remove 16.3.

EricCoteReact avatar Nov 13 '19 15:11 EricCoteReact

Since I know French, I localized the strings to French. Other languages will have to be localized (by other folks).

EricCoteReact avatar Nov 14 '19 05:11 EricCoteReact

Hello there. I would like to help with this PR moving into master. And then add Ukrainian localization. Why this freezing? PR no longer maintained?

vkabysh avatar May 27 '20 05:05 vkabysh

I need a substantial amount of time to figure out and code the navigation, or perhaps splitting this into a separate app completely.

wojtekmaj avatar May 27 '20 09:05 wojtekmaj

Is this going any further? Seeing as this is a very common lifecycle reference, it would be great to add the hooks version. A toggle-able option between hooks and class based component would work well I think, which i'm happy to implement if that sound suitable? @wojtekmaj

bradmk-1 avatar Jul 16 '22 15:07 bradmk-1

Since there are 0 commits (somehow) in this PR I'm gonna close this one.

As previously stated, I think a hook-only fork is more suitable for this.

wojtekmaj avatar Oct 06 '22 09:10 wojtekmaj