Coder Social home page Coder Social logo

wojtekmaj / react-lifecycle-methods-diagram Goto Github PK

View Code? Open in Web Editor NEW
3.8K 52.0 315.0 5.11 MB

Interactive React Lifecycle Methods diagram.

Home Page: https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/

License: MIT License

HTML 2.30% CSS 14.92% TypeScript 82.78%
react react-lifecycle diagram cheatsheet

react-lifecycle-methods-diagram's Introduction

CI

React Lifecycle Methods diagram

An interactive version of React Lifecycle Methods diagram tweeted by Dan Abramov. Built with React, obviously.

I did my best to make the diagram fully accessible, both for keyboard navigation and screen readers for visually impaired people.

Online version is also available!

How to use the diagram

  • Click any method name to read its official documentation (opens in a new tab).
  • Methods in bold are the most common ones.
  • Actions that are not methods, but otherwise help reading the diagram, are in italics.

Collaboration

You are welcome to raise issues and create pull requests.

Particularly valuable contributions are those regarding i18n as I only know so many languages. Adding new locale is pretty easy, but there's a separate i18n guide in case you get lost.

You can also add a new version of the diagram in case React lifecycle methods are changed. There is a separate versions guide in case you get lost.

Prerequisites

To contribute, you need to have the following prerequisites installed:

  • Node.js
  • Yarn
  • IDE of your choice

Starting the project

  • yarn install (first time only)
  • yarn dev

Building the project

  • yarn build

License

The MIT License.

Author

Wojciech Maj
[email protected]
https://wojtekmaj.pl

Thank you

Sponsors

Thank you to all our sponsors! Become a sponsor and get your image on our README on GitHub.

Backers

Thank you to all our backers! Become a backer and get your image on our README on GitHub.

Top Contributors

Thank you to all our contributors that helped on this project!

Top Contributors

react-lifecycle-methods-diagram's People

Contributors

ahangarha avatar alansyue avatar armin77 avatar beahuszar avatar chefk5 avatar codewithnitesh avatar dependabot[bot] avatar egorchh avatar eyesofkids avatar joristirado avatar laradeoliveira avatar lex111 avatar majedbojan avatar mareksuscak avatar mariuspop86 avatar movses avatar munierujp avatar nadabouzidi avatar nathanlschneider avatar nedolia avatar oerd avatar qc-l avatar r17x avatar rabbanirizwan avatar shenburak avatar shiralizadeh avatar smolinpavel avatar vidalpaul avatar wojtekmaj avatar yoshimii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-lifecycle-methods-diagram's Issues

"New props" arrow label is misleading

Motivation

I realize that the phrase "New props" is in the original tweet of Dan Abramov, but "new props" is vague and misleading. Further, it tends to reinforce the misconception mentioned in Brian Vaughn's blog post that the "Updating" swimlane is triggered only when the props "change" or are "different" ( "new" props suggests "different" from "old" props). As the blog post says "these lifecycles are called any time a parent component rerenders, regardless of whether the props are 'different' from before".

Proposal

Change the wording to say "parent rerenders" or something similar.

Aside

I'm not trying to be picky. Dan's diagram and your project have been infinitely helpful in aiding my understanding, yet I've continuously seen beginner, intermediate, and even some advanced React developers tripped up by this confusion. It's a small change, but if you agree, I can help out and do the PR as well.

componentWillUnmount and refs to null?

I started to wonder, does React set all the refs to null before it calls componentWillUnmount or after?

However the diagram does not tell? Which one is it?

image

Add Macedonian language

Macedonian language is missing and all of the docs are leading to the old documentation so I would like to update that.

Why not show china flag icon in language selection?

I saw that the Chinese flag 🇨🇳was specifically filtered out in the code and turned into the earth icon🌏 ,I feel this is very unfriendly,please remove the relevant filtering code immediately.

Change Arabic language flag in drop-down menu

The language drop-down menu shows Argentina flag for Arabic language. The reason is probably because of the value used for Arabic option is AR, which is ISO for Argentina flag emoji.
Suggested solution is to replace the language code to become AE or SA .

useTranslation is being called way more than it should

useTranslation() gets called way too much. Between 350 and 450 times per screen. (it depends on the screen). Because it updates the state in a useEffect(), it gets re-rendered and called a few times.

It should be called way less often (below 35 times per screen).
You can easily see this by placing a console.log() in the main body of the useTranslation() function.

Bug when displaying less common lifecycles

When checking the checkbox do display the less common lifecycles, a bug happens and changes the name of some of the states to render. You can see this in the print below

image

It would be great to have a title :)

Something like 'React lifecycle methods'.

When sharing the online version with other people if I don't tell them beforehand what's the link about, it's not so easy to understand what's the diagram about at first glance.

"Chinese(Taiwan)" is incorrect! ⚠️

image

"Chinese(Taiwan)" is is incorrect. "Chinese(Traditional)" is right! Chinese language, only the difference between simplified Chinese and traditional Chinese, there is no difference between regions.

You should avoid possible political problems.

@wojtekmaj

Show hooks

It would be nice to show where the callbacks in hooks are fired.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.