React Cheatsheet

Updated every so often for code that I come across

React is confusing, especially for someone who has never touched Javascript before. As I am going through my personal journey on learning/mastering this language, I thought it would be nice to have this Glossary to share with everyone.

componentDidMount()

  • Called at the end of every render()
  • A good place to load in data, and call setState() to re-render the page with the new information

arrowFunction = ( ) =>”hello”

  • Not necessarily a React ONLY component, because it is used across all of js. Since there are a lot of component inside component code, and calling other functions, I have seen it a lot within React.
  • the purpose of the arrow is to ensure that the correct “this” is being called
  • The object of where the function was being called will be referred to as “this”, rather than the potential of returning null if not bound correctly with “bind”.
  • arrow function could cause slower rendering because a new function needs to be created

Some Good Resources:

professors never gave me a chance, but I can give myself one.