|
| 1 | +1.React follows one way data binding or two way data binding? |
| 2 | +React follows one-way data binding. |
| 3 | + |
| 4 | +Explanation: |
| 5 | +In React, data flows in a single direction — from parent components to child components. This is referred to as one-way data binding. |
| 6 | + |
| 7 | +Parent to Child Flow: |
| 8 | + |
| 9 | +Data is passed from the parent component to the child component via props. |
| 10 | +The child component cannot directly modify the parent’s state; it can only receive the data and use it. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +2. Props: Props are a way to pass data from a parent component to a child component in React. |
| 16 | +They are immutable within the child component and provide one-way data flow. |
| 17 | +Props allow you to customize and re-use components with different data. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +3. props vs state? |
| 22 | + |
| 23 | +When to Use |
| 24 | +Props: |
| 25 | + |
| 26 | +Use props when you want to pass data from parent to child or configure a child component based on data. |
| 27 | +For example, displaying user information in a child component or passing callback functions. |
| 28 | +State: |
| 29 | + |
| 30 | +Use state for data that changes over time or in response to user actions, events, or API calls. |
| 31 | +For example, tracking form input, toggling visibility, or handling the results of a network request. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +4.How to Pass Data from Child to Parent:? |
| 36 | + |
| 37 | +Parent component defines a function (callback). |
| 38 | +Parent component passes this function to the child component via props. |
| 39 | +Child component calls the function passed via props and passes the data back to the parent. |
| 40 | + |
| 41 | +5. What is Key? |
| 42 | + |
| 43 | +In React, keys are special identifiers used in lists of elements to help React |
| 44 | + identify which items have changed, been added, or removed. They are necessary when rendering dynamic lists of components or elements. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +6.Contemporay of react js? |
| 49 | + |
| 50 | +React :is the best choice for flexibility, a large ecosystem, and when you want to create dynamic user interfaces with reusable components. |
| 51 | +Vue :is great if you need simplicity, flexibility, and a gentle learning curve, especially for smaller projects or when you prefer minimal setup. |
| 52 | +Angular: is ideal for large-scale applications with complex requirements, where you need a comprehensive solution for routing, state management, and more. |
| 53 | +Svelte: shines if you want a highly efficient framework with less overhead and faster performance, particularly for small to medium-sized projects. |
| 54 | +Preact: is a perfect choice for performance-sensitive apps where bundle size matters, while still keeping compatibility with React. |
| 55 | +Lit: is best when building Web Components that need to be highly reusable across different platforms and frameworks. |
| 56 | + |
| 57 | + |
| 58 | +7. |
| 59 | +No, Angular does not use a virtual DOM like React. Instead, Angular uses real DOM for its updates. |
| 60 | + |
| 61 | + |
| 62 | +8.Summary of Lifecycle Methods (Class Components): |
| 63 | +Mounting: constructor(), getDerivedStateFromProps(), render(), componentDidMount() |
| 64 | +Updating: getDerivedStateFromProps(), shouldComponentUpdate(), render(), getSnapshotBeforeUpdate(), componentDidUpdate() |
| 65 | +Unmounting: componentWillUnmount() |
| 66 | +In functional components, the useEffect() hook is used to replicate the functionality of class component lifecycle methods. |
| 67 | + |
| 68 | + |
| 69 | +9. Primitive types are basic types like strings, numbers, and booleans. |
| 70 | +Non-primitive (reference) types include objects, arrays, and functions, and they are stored in memory as references. |
| 71 | + |
| 72 | + |
| 73 | +10.Axios |
| 74 | +Axios is a popular JavaScript library used to make HTTP requests |
| 75 | + |
| 76 | +Key Features of Axios: |
| 77 | +Promise-based: Axios uses Promises for handling asynchronous HTTP requests and responses. |
| 78 | +Supports all HTTP methods: GET, POST, PUT, DELETE, PATCH, etc. |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +11. Selectors in CSS |
| 83 | + |
| 84 | +Summary of Key Selectors: |
| 85 | +Universal Selector (*): Targets all elements. |
| 86 | +Type Selector (e.g., div, p): Targets elements by type. |
| 87 | +Class Selector (.class): Targets elements with a specific class. |
| 88 | +ID Selector (#id): Targets a single element with a specific ID. |
| 89 | +Attribute Selectors: Targets elements based on attributes. |
| 90 | +Pseudo-Classes: Target elements based on their state or position (e.g., :hover, :first-child). |
| 91 | +Pseudo-Elements: Target specific parts of an element (e.g., ::before, ::first-letter). |
| 92 | + |
| 93 | +Priority Order (Highest to Lowest): |
| 94 | +Inline styles (e.g., style="color: red;"): Highest specificity, directly in the element. |
| 95 | +ID Selectors (#id): Higher specificity than class, attribute, and type selectors. |
| 96 | +Class Selectors, Attribute Selectors, Pseudo-Classes (.class, [type="text"], :hover): Medium specificity. |
| 97 | +Type Selectors (div, p): Low specificity. |
| 98 | +Universal Selector (*): Lowest specificity. |
| 99 | + |
| 100 | + |
| 101 | +12. anchor tag for hyperlink |
| 102 | +13.atrribute |
| 103 | +In HTML, attributes provide additional information about an element and help define its |
| 104 | +properties or behavior. They are written within the opening tag of an element and are used to modify the element's default behavior. |
| 105 | + |
| 106 | +Here’s an overview of some |
| 107 | +id class required value placeholder href target img |
| 108 | + |
| 109 | +14. The <iframe> tag in HTML is used to embed another HTML document within the current document. |
| 110 | +It creates an inline frame, which acts as a "window" to display another webpage, video, or interactive content. |
0 commit comments