React Hooks


useState is a function that accepts a single argument which is the initial state.

What is State?

State can be defined as: data that changes over time.

Lazy State Initialization

useState allows us to pass a function instead of the actual value, and then it will only call that function to get the state value when the component is rendered the first time.


useEffect is a built-in hook that allows us to run some custom code after component render and re-render.

Dependency Array

useEffect allows us to pass a second argument called the “dependency array” which signals to React that your effect callback function should be called when (and only when) those dependencies change.



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