GoConqr has a new look! Let us know what you think.

Flashcards

JS Rappels pour React

dadou siplancin JS React vaze English 9 cards

Cards in this deck (9)

  1. 1const grades = [10, 2, 21, 35, 50, -10, 0, 1]; Avoir seulement les notes au dessus de 20 :const result = grades.filter(grade => grade > 20);
  2. 2Complete the function getPassingTests such that it returns all the test results that have a passing grade (10 and above). const data = [ {id: 1, grade: 20} ]function getPassingTests(results) {
    return results.filter(result => result.grade >= 10);
    }
  3. 3What is React utilty ?React is a JavaScript library that is only responsible for the view layer of your application.
  4. 4Types of import + Syntax- Default import : import Something from "package-name".
    - Named export : import {Something} from "package-name".
  5. 5ReactDOM & Virtual DOM DefReactDOM
    - Glue between React and the DOM
    - Library that efficiently updates the DOM based on that Virtual DOM.
    VirtualDOM
    - Representation of the UI kept in memory & synced with the DOM.
    - Exists to figure out which parts of the UI need to be updated and then batch these changes together.
  6. 6ReconciliationProcess of syncing the Virtual DOM to the actual DOM.
  7. 7With ReactDOM, how to render React elements on the page ? + precautionimport {createRoot} from "react-dom/client";
    const root = document.querySelector("\#root");
    createRoot(root).render(React.createElement("p", {}, "Hello World"));
    We create the root of the React app using createRoot(root).
    On the result of createRoot(root), we call .render() and pass to it our React element.
    (#root is an existing html element)
    precaution : This root element that you pass to ReactDOM will become completely managed by React. So you should not write any kind of JavaScript that changes its content
  8. 8Difference between React & document createElement :document.createElement returns a DOM element (for example a div or an h1). Whereas React.createElement returns an object that represents the DOM element (=> because React operates a Virtual DOM).
  9. 9What is an element in React ?- The smallest building block
    - (Represents what the smallest piece of your User Interface will look like)

Information

Description
vaze JS React Flashcards on JS Rappels pour React, created by dadou siplancin on 03/03/2023.
Created by
dadou siplancin
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?