In React class components, we had the componentDidUpdate method, which provided the previous prop and state arguments. Now, with functional components, we have effects. In order to accomplish saving the previous state and prop values, we can store them to a ref. Refs do not have to be a DOM object.

usePrevious stores the value to the ref, but the useEffect doesn’t run until the component is rendered. So the current value is returned, and it is stored for next time.

Then, in the component, you can use usePrevious and pass it the value you want to keep track of.



#1 Javascript for widest applicability

Javascript & React (as of 2021)

Javascript and React have the widest applicability in multiple job types. If you learn javascript (and typescript as a bonus), it opens opportunities into:

  1. Front end web development (React)
  2. Back end web development (Node.js)
  3. Mobile development (React Native)
  4. Desktop development (React + Electron)

The strategy here is to choose a language (and technologies) that are most in demand, and have a good future outlook. You can tell by observing trends in job postings, open source projects, and where developers tend to flock. Usually there are a few go-to languages and technologies that certain types of developers prefer.

Watch as new technologies come out, every once in a while a game changer will start to attract the majority of developers, and that is usually a good sign to start getting on board, as the jobs will follow.