R1 Flashcards
What is React?
React is a JavaScript library for building user interfaces, focusing on component-based development and efficient rendering.
What is React Router v6?
React Router v6 is a routing library for React that helps manage navigation and routing within a React application.
What is Redux used for in a React application?
Redux is a state management library used to manage the global state of a React application in a predictable and centralized way.
What is the purpose of the Button component in Material-UI?
The Button component is used to create clickable buttons with different styles and configurations.
When would you use the TextField component in Material-UI?
The TextField component is used to create input fields for text entry and form submissions.
What is the role of the AppBar component in Material-UI?
The AppBar component is used to create a top app bar for navigation, branding, and other app-related actions.
How does the Material-UI Grid 2.0 system help with layout in a React app?
The Material-UI Grid 2.0 system provides a flexible and responsive grid layout that helps organize and structure components within a layout.
What is the purpose of the setState method in React?
The setState method is used to update the state of a React component, triggering re-rendering and reflecting changes in the UI.
What is the recommended way to update state using setState?
The recommended way is to provide a function to setState, which receives the previous state and returns the new state. This ensures proper handling of asynchronous updates.
What are props in React?
Props (short for properties) are a way to pass data from a parent component to a child component in React. They are read-only and help customize the behavior and appearance of components.
How are props used in a React component?
Props are passed as attributes to a component when it’s used within another component. The component can access and use these props to render content dynamically.
What is the purpose of props in React applications?
Props enable components to be reusable and flexible by allowing them to receive data and settings from their parent components. This helps achieve modularity and separation of concerns.
How can child components communicate with their parent components in React?
Child components can communicate with their parent components by invoking functions passed as props from the parent. This way, the child can trigger actions in the parent’s context.
What is the concept of “lifting state up” in React?
Lifting state up refers to the practice of moving the state of a component to a common ancestor that’s higher up in the component hierarchy. This allows child components to share and update state through props.
How can child components notify their parent components of events or changes?
Child components can send data or trigger functions provided by their parent components through props. This allows them to notify the parent of specific events or state changes.