Which of the following statements about reducers in Redux is true?
Reducers are not necessary in Redux.
Reducers can have side effects like API calls or database operations.
Reducers can modify the previous state directly without returning a new state.
Reducers are a pure function that takes the previous state and an action as parameters and returns the new state.
Reducers in Redux are pure functions that take the previous state and an action as parameters and return the new state. They should not modify the previous state directly, but instead create a new state based on the previous state and the action. This ensures that Redux follows the principle of immutability, making it easier to track state changes and debug the application. Reducers should also not have any side effects like API calls or database operations, as they should only be responsible for state transformations.