To use local storage in React, we can introduce a custom hook that uses useState and useEffect internally in combination with the local storage api.