Fichas
React-Native Interview Questions
Fichas del conjunto (26)
- 1What are the differences between REAL DOM and VIRTUAL DOM?Real:
-Updates slowly
-Directly updates HTML
-Creates new DOM if elements update
-DOM manipulation is very expensive
-Virtual
-Updates faster
-Cant directly update HTML
-Updates the JSX if element updates
-DOM manipulation is very easy
-No memory wastage - 2What is React?-Front-end JS library developed by FB
-Follows component based approach
-For developing complex and interactive web and mobile UI
-Open-Sourced - 3What are features of React?-uses virtual DOM instead of the real DOM
-Uses server-side rendering
-Follows uni-directional flow or data-binding - 4Some major advantages of React?-Increases the app's performance
-can be conveniently used on client as well as server side
-JSX -> code readability increases
-Easy to integrate with other frameworks
-UI Test are written extremely easy - 5What are some limitations of React?-Is just a library
-Not a full blown framework
-Library is very large, takes time to understand
-a little difficult for novice programmers to understand
-Coding gets complex as it uses inline templating and JSX - 6What is JSX?-JavaScript XML
-Uses the expressiveness of JavaScript along with HTML like template syntax - 7What is DOM?-A DOM is a lightweight JS object which is the copy of the original DOM.
-It is a node tree which lists the elements, their attributes and content as Objects and their properties - 8How does the DOM work?-Whenever any underlying data changes, the entire UI is re-rendered in Virtual DOM representation
-The difference between the OG DOM and the new one is calculated
-Once calculations are done, the real DOM will be updated with only the things that have actually changed - 9Why cant browsers read JSX?-Browsers can only read javaScript objects
-JSX is not a regular JS object
-Must use JSX transformers like babel to transform JSX file into JS object to be passed to the browser - 10How different is ES5 syntax from ES6 syntax?-Require vs Import
-Export vs Exports
-Component and Function
-Props
-State - 11How is React different from Angular?-Architecture: Only the View of MVC
:Complete MVC
-Rendering: Server-Side Rendering
:Client-Side Rendering
-DOM: Uses Virtual DOM
:Uses real DOM
-Data Binding: One-Way data-binding
: Two-Way data-binding
-Debugging: Compile time debugging
:Runtime debugging
-Author: Facebook
:Google - 12What do you understand from "In React, everything is a Component"-Components are the building blocks of a React app's UI
-These components split up the entire UI into small independent and reusable pieces
-Then it renders each of these components independent of each other without affecting the rest of the UI - 13Explain the purpose of the render() in React-It returns a single React element which is the representation of the native DOM component
-If more than on HTML element needs to be rendered, then they must be grouped together inside a closing tag - 14What is Props?-Read-Only components which must be kept pure i.e. immutable
-Always passed down from the parent to the child components throughout the application - 15What is a State in React and how is it used?-Are the source of data and must be kept as simple as possible
-Are objects which determine components rendering and behavior
-Mutable and create dynamic and interactive components
-Accessed via "this.state" - 16Differentiate between States and Props-Receive initial value from parent component: Yes, Yes
-Parent component can change value:
No, Yes
-Set default values inside component: Yes, Yes
-Changes inside component: Yes, No
-Set initial value for child components: Yes, Yes
-Changes inside child components: No, Yes - 17What is arrow => function in React?-Used to write function expressions
-Allow to bind the context of the components properly
-Useful for higher-order functions - 18Differentiate between stateful and stateless componentsdd
- 19What are the different phases of React's component's lifecycle?-Initial Rendering Phase: when the component is about to start its life journey and makes its way to the DOM
-Updating Phase: Once component gets added to DOM, can potentially update and re-render only when a prop or state change occurs. Happens only in this phase
-Un-mounting Phase: Final phase of a component's life cycle in which the component is destroyed and removed from the DOM - 20Lifecycle methods of React?1-componentWillMount(): Executed just before rendering takes place both on the client as well as server-side
2-componentDidMount(): Executed on the client-side only after the first render
3-componentWillReceiveProps(): Invoked as soon as the props are received from the parent class and before another render is called
4-shouldComponentUpdate(): Returns true or false value based on certain conditions. Default returns false
5-componentWillUpdate(): Called just before rendering takes place in the DOM
6-componentDidUpdate(): Called immediately after the rendering takes place
7-componenetWillUnmount(): Called after the component is unmounted from the DOM. It is used to clear up the memory spaces - 21What is an Event in React?-Are triggered reactions to specific actions like mouse hover, mouse click, key press, etc
-Handles these events similar to events in DOM elements
-The event argument contains a set of properties, which are specific to an event
-Each event contains its own properties and behavior which can be accessed via its event handlers only - 22What are synthetic events in React?-Objects which act as a cross-browser's native event.
-Combine behavior of different browsers into one API - 23What are refs?-References
-Attribute which helps to store a reference to a particular React element or component, which will be returned by the components render configuration - 24What are some cases where we should use refs?-When you need to manage focus, select text or media playback
-To trigger imperative actions
-Integrate with Third-party DOM libraries - 25How do we modularize code in React?-By using export import properties
-Help in writing the components separately in different files - 26How are forms created in React?-Are similar to HTML forms
-
Información
- Descripción
- 50 React-Native Interview Questions
- Creado por
- andrew tittle
- Visitas
- 10
- Valoración