React Hooks Flashcards

1
Q

What is the purpose of the useState hook?

A

It lets you add state to functional components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the useEffect hook do?

A

It performs side effects (like data fetching, DOM manipulation, etc.) in functional components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain the useReducer hook and its use cases.

A

useReducer is an alternative to useState that’s more suited for managing complex state logic. It accepts a reducer function and an initial state, returning the current state paired with a dispatch method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly