React

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What are the benefits of React?

Below are the advantages of ReactJS: Increases the application's performance with Virtual DOM JSX makes code is easy to read and write It renders both on client and server side Easy to integrate with other frameworks (Angular, BackboneJS) since it is only a view library Easy to write UI Test cases and integration with tools such as JEST.

What is the difference between a Presentational component and a Container component?

Presentational components are concerned with how things look. They generally receive data and callbacks exclusively via props. These components rarely have their own state, but when they do it generally concerns UI state, as opposed to data state. Container components are more concerned with how things work. These components provide the data and behavior to presentational or other container components. They call Flux actions and provide these as callbacks to the presentational components. They are also often stateful as they serve as data sources.

What is React?

React is an open-source JavaScript library created by Facebook for building complex, interactive UIs in web and mobile applications. React's core purpose is to build UI components; it is often referred to as just the "V" (View) in an "MVC" architecture.

What are the major features of ReactJS?

The major features of ReactJS are as follows, It uses VirtualDOM instead RealDOM considering that RealDOM manipulations are expensive. Supports server-side rendering Follows Unidirectional data flow or data binding Uses reusable/composable UI components to develop the view

What are the different phases of ReactJS component lifecycle?

There are four different phases of React component's lifecycle: Initialization: In this phase react component prepares setting up the initial state and default props. Mounting: The react component is ready to mount in the browser DOM. This phase covers componentWillMount and componentDidMount lifecycle methods. Updating: In this phase, the component get updated in two ways, sending the new props and updating the state. This phase covers shouldComponentUpdate, componentWillUpdate and componentDidUpdate lifecycle methods. Unmounting: In this last phase, the component is not needed and get unmounted from the browser DOM. This phase include componentWillUnmount lifecycle method.

What are the limitations of React?

There is a learning curve for beginners who are new to web development. Integrating React.js into a traditional MVC framework requires some additional configuration The code complexity increases with inline templating and JSX. Too many smaller components leading to over-engineering or boilerplate

Why does React use className?

class is a keyword in javascript and JSX is an extension of javascript.

how are props and state different?

Both props and state are plain JavaScript objects. While both of them hold information that influences the output of render, they are different in their functionality with respect to component. i.e, Props get passed to the component similar to function parameters state is managed within the component similar to variables declared within a function.

Describe how events are handled in React.

In order to solve cross browser compatibility issues, your event handlers in React will be passed instances of SyntheticEvent, which is React's cross-browser wrapper around the browser's native event. These synthetic events have the same interface as native events you're used to, except they work identically across all browsers. What's mildly interesting is that React doesn't actually attach events to the child nodes themselves. React will listen to all events at the top level using a single event listener. This is good for performance and it also means that React doesn't need to worry about keeping track of event listeners when updating the DOM.

What is the difference between a React element and component?

Simply put, a React element describes what you want to see on the screen. Not so simply put, a React element is an object representation of some UI. A React component is a function or a class which optionally accepts input and returns a React element (typically via JSX which gets transpiled to a createElement invocation).

What is virtual DOM?

The virtual DOM (VDOM) is an in-memory representation of Real DOM. The representation of a UI is kept in memory and synced with the "real" DOM. It's a step that happens between the render function being called and the displaying of elements on the screen. This entire process is called reconciliation.

talk about JSX

When Facebook first released React to the world, they also introduced a new dialect of JavaScript called JSX that embeds raw HTML templates inside JavaScript code. JSX code by itself cannot be read by the browser; it must be transpiled into traditional JavaScript using tools like Babel and webpack. While many developers understandably have initial knee-jerk reactions against it, JSX (in tandem with ES2015) has become the defacto method of defining React components.


Ensembles d'études connexes

Christian Beliefs - Chapter 7 mod What is Man?

View Set

ATI FUNDAMENTALS (dynamic quizzes)

View Set

Marine Biology Chapter 10 & 11 Test

View Set

351 Chapter 12 Quiz, Quiz 11 Social Psych, Social Psych Ch. 10 Quiz, CU Social Psych Final

View Set

Night Sections 4-5, quiz, and characters

View Set

Chapter 13: Electricity Milady Cosmetology

View Set

NURS 155 Exam 3 Success Questions

View Set