0% found this document useful (0 votes)
23 views

React Hooks Interview Questions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

React Hooks Interview Questions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

React Hooks Interview Questions

● UseState
○ Functional components to manage state in local state.
Syntax:
const[state,setState] = useState(initialstate);
● React components lifecycle in hooks
○ useeffect
● Useeffect
○ perform side efeects like Data fetching, subscriptions or manually
changing the dom
○ [] it should run only once
○ Include variables means it chn]ange wheneve it change
Syntax:
useEffect(() => {},[dependencies])

Usememo
Returns a memoized value.
performance optimization
Usecallback
returns a memoized version of the callback function that only changes if one of
the dependencies has changed.
useful when passing callbacks to child components
Prevent unnecessary re renders
Useref
reference a value i.e pointing out the reference like object
Usecontext

Usereducer
Alternate to usestate for managing more complex state
Takes reducer function and initial state then returns current state and
dispatch function

You might also like