Home > Mobile >  fetching from Local Json in React usinguseEffect and componentDidMount
fetching from Local Json in React usinguseEffect and componentDidMount

Time:04-24

I am trying to fetch some data from local JSON to Reac. I have searched and come to two methods: useEffect and componentDidMount. Which one should I use?

CodePudding user response:

If you use functional component (React version >= 16.8) use UseEffect and If you use class component you should use componentDidMount.

  • Related