React

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

What is a high-order component?

A high-order component is an advanced technique in React for reusing component logic. HOC's allow you to reuse code, logic, and bootstrap abstractions.

Explain the Components of Redux

Action - payloads of information that send data from our application to our store. We send them to the store using store.dispatch( ). They are an object that describes what happened in our app. Reducer - Specify how the application's state changes in response to actions sent to the store. Remember that actions only describe what happened, but don't describe how the application's state should change. Store - The object that brings Action and Reducer together. The store has the following responsibilities: Hold application state, allow access to state via getState( ), allow state to be updated via dispatch(action), register listeners via subscribe(listener), handle unregistering of listeners via the function returned by subscribe(listener)

What's the difference between a class component and a functional component?

Class components allows us to use additional features such as local state and lifecycle hooks. When a component simply receives props and renders them to the page however, this is known as a functional, or stateless, component.

What is does render( ) do?

Each React component must have a render method mandatorily. It returns a single React element which is the representation of the native DOM component.

What is React.createClass?

It allows us to generate component classes. We pass in an object as an argument. Alternatively, you can create a class by extending the React.Component library.

What is create-react-app?

It is the official CLI for React to create React apps with no build configuration

What is JSX?

JSX is a syntax extension to JavaScript. JSX produces React "elements", and you can embed any JavaScript expression in JSX by wrapping it in curly braces.

What is PureComponent? When do you use PureComponent over Component?

PureComponent is exactly the same as Component except that it handles the shouldComponentUpdate method for us. When props or state changes, PureComponent will do a shallow comparison on both props and state. Component, on the other hand, won't compare current props and state to next out of the box. It's a good idea to prefer PureComponent over Component whenever we never mutate our objects.

How does React work?

React creates a virtual DOM. When state changes in a component it firstly runs a "diffing" algorithm, which identifies what has changed in the virtual DOM. The second step is reconciliation, where it updates the DOM with the results of diff.

What is the difference between React and React Native?

React is a JavaScript library, supporting both frond end web and being run on the server, for building user interfaces and web applications. React Native, on the other hand, is a mobile framework that compile to native app components, allowing us to build native applications in JavaScript that allows us to use ReactJS to build components.

What is the difference between React and ReactDOM?

ReactDOM is a library used for one specific purpose: bridging between the React code and the DOM. On the other hand, we use React to define our elements, lifecycle hooks, etc.

What is Redux Thunk used for?

Redux thunk is middleware that allows us to write action creators that return a function instead of an action. The thunk can then be used to delay the dispatch of an action if a certain condition is met.

What is Redux?

The basic idea of Redux is that the entire app state is kept in a single store. The store is simply a JavaScript object. The only way to change the state is by firing actions from your application and then writing reducers for these actions that modify the state. It's based on the idea that there should be only a single source of truth for your application state.

What are controlled components?

The component containing the form will keep track of the value of the input in it's state and will re-render the component each time the callback function onChange is fired as the state will be updated

What is the difference between state and props?

The state is a data structure that starts with a default value when a Component mounts. It may be mutated across time, mostly as a result of user events. Props (short for properties) are a Component's configuration. They are received from above and immutable as far as the Component receiving them is concerned. A Component cannot change its props, but it is responsible for putting together the props of its child Components. Props do not have to just be data - callback functions may be passed in as props.


Ensembles d'études connexes

Finance Management Chapter 11 - FIN 780

View Set

Education 2130 Midterm: Chapter 1

View Set

Abeka 9th Grade World Geography Chapter 6 Section 1 Review

View Set

IELTS Masterclass Unit 2 Conflicting Interests

View Set

Psych 354 Final Exam (chapters 1-14)

View Set

Test 2 Left Bank Bordeaux, New Zealand, Romania

View Set

Chapter 2 Equal Opportunity and the Law

View Set