React Hooks: A transition of functions from stateless to stateful components

useState -

const [state, setState] = useState(initialState)
  1. We need a way to add a todo item in our todo list.
  2. We need a way to update the status of our todo item.
  1. Functional updates:
    If the new state is related to the old state, then it's a good practice to pass a function to the setState. One of the problems that I solved using this is mentioned in one of my previous blog.
  2. Lazy initial state:
    It is a state used during the initial render. For more info on this, visit



Software Developer by profession, with a passion of sharing knowledge.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store