DEV Community

Cover image for An Experience I had using react hooks (useEffect, useState). Not the best practice but why did it work🤔🤔
Niidarku
Niidarku

Posted on

An Experience I had using react hooks (useEffect, useState). Not the best practice but why did it work🤔🤔

So I was trying to perform an update on a component being mounted by fetching data from an api into a react app, I prefer functional components with hooks to class components. Upon trying to use the useEffect hook I mistakenly used useState in the same form I would have use the useEffect hook and to my surprise the request went through and the component was correctly updated 🤔.

react #hooks

Top comments (0)