Posts

Showing posts from December 14, 2018

What’s the difference between useState and useEffect?

Image
up vote 0 down vote favorite I have seen these two new concepts introduced in react v16. As per my understanding: useState is similar like setState with hooks and useEffect works similarly like life cycle methods. Is my understanding correct? If not, what’s the exact difference between useState and useEffect ? javascript reactjs react-native react-hooks share | improve this question edited Nov 10 at 21:14 Yangshun Tay 8,586 5 36 66 asked Nov 9 at 2:51 Hemadri Dasari 7,011 1 10 39 add a comment  |  up vote 0 down vote favorite I have seen these two new concepts introduced in react v16. As per my understanding: useState is similar like setState with hooks and useEffect works similarly like life cycle methods. Is my understanding correct? If not, what’s the exact difference between useState and useEffect ? javascript reactjs react-native react-hooks share | improve this question edited Nov 10