React Flashcards
What are components in React?
The building blocks of a React application. Components can be either class components or functional components (the latter are more common now with the introduction of hooks).
What is JSX?
A syntax extension that allows you to write HTML-like code within JavaScript. It makes it easy to create React elements.
What are props in React?
Short for ‘properties,’ these are used to pass data from parent components to child components. Props are read-only and help in making components reusable.
What is state in React?
A component’s internal data that can change over time. State is managed within a component and can affect how the component renders.
What are lifecycle methods in React?
Special methods in class components that allow you to run code at specific points in a component’s life (e.g., when it mounts, updates, or unmounts). With functional components, you can achieve similar behavior using the useEffect hook.
What are hooks in React?
Functions that let you use state and other React features in functional components. Common hooks include useState for state management and useEffect for side effects.
What is conditional rendering in React?
A technique to render different UI elements based on certain conditions, often using JavaScript expressions within JSX.
How do you render lists in React?
You can render lists of elements in React using the .map() method. Each element in a list should have a unique ‘key’ prop to help React identify and manage changes efficiently.
What is a store in Redux?
A centralized repository that holds the application’s state. There’s only one store in a Redux application.
What are actions in Redux?
Plain JavaScript objects that describe what happened in the application. An action must have a type property, and it can also have additional data (payload).
What are reducers in Redux?
Pure functions that take the current state and an action, and return a new state. They specify how the state changes in response to actions.
What is dispatch in Redux?
A method used to send actions to the store. When an action is dispatched, it triggers the reducer to update the state.
What are selectors in Redux?
Functions that extract specific pieces of data from the Redux store. They help in accessing the state more efficiently.
What is middleware in Redux?
Functions that provide a way to extend Redux’s abilities, often used for logging, handling asynchronous actions, or performing side effects.
What is a provider in Redux?
A component that makes the Redux store available to the rest of your app. It wraps the main application component.
How do you connect components to Redux?
You can connect React components to the Redux store using the connect function or the useSelector and useDispatch hooks in functional components.