Skip to content
- What is Redux, and why use it with React?
- Redux is like a manager for information in a web app. It helps keep track of everything happening in the app. When using React, Redux makes it easier to organize and control how information changes.
- Explain the main ideas of Redux.
- Single source of truth: All the important information about the app is kept in one place.
- State is read-only: You can’t directly change the information; you have to ask the manager (Redux) to do it.
- Changes are made with pure functions: The manager follows clear rules when updating the information.
- What is an action in Redux?
- An action is like a note you give to the manager. It tells the manager what you want to do. It must say what kind of action it is.
- What is a reducer in Redux?
- A reducer is like an assistant to the manager. It looks at the note (action) and decides what to do with the information based on the type of action.
- What does the dispatch function do in Redux?
- The dispatch function is like telling the manager to read the note (action) and make the necessary changes to the information.
- Explain middleware in Redux.
- Middleware is like a helper for the manager. It can do extra things before the manager decides what to do with the information, like checking it or logging it.
- How do mapStateToProps and mapDispatchToProps work in React-Redux?
- mapStateToProps is like telling the manager what information you want from the store. It gives you that information as props.
- mapDispatchToProps is like telling the manager what actions you want to do. It gives you functions that dispatch those actions.
- What is the purpose of the connect function in React-Redux?
- The connect function is like introducing your component to the manager. It connects your component to the store, so it can get information and do actions with the help of the manager.