General Concepts Flashcards

1
Q

Synchronous operations

A

are executed one at a time, and each operation must complete before the next one can start. In other words, synchronous operations block the execution of the program until they are finished.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

asynchronous operations

A

do not block the execution of the program. Instead, they are designed to allow the program to continue executing other tasks while waiting for the asynchronous operation to complete.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

purpose of a callback

A

to specify a function that will be executed or called at a later point in the program, often as a response to an event or the completion of an asynchronous operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

setState what is does? is syncronic?

A

When you call setState, React will update the state object and trigger a re-rendering of the component, which means the component will update and reflect the new state.

The setState method in React is typically asynchronous. This means that calling setState doesn’t immediately update the state and re-render

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

this.state = {
counter: 0,
name: ‘John’
}; how to access to counter state?

A

this.state.counter holds the value of the counter, and this.state.name holds the value of the name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

when getDerivedStateFromProps is called?

A

getDerivedStateFromProps is a static method that is called before rendering and is invoked whenever the component is receiving new props or state updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

getDerivedStateFromProps method for funtions?

A

It should be used for pure calculations based on props and state, without relying on any component-specific instance variables or methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

can I use this in getDerivedStateFromProps?

A

is a static method, so you cannot access the this keyword or the component instance within this method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

why getDerivedStateFromProps is static?

A

By making it static, it is enforced that the method does not have access to the component instance (this) and cannot modify any instance-specific data or invoke instance methods. meaning its output solely depends on the inputs and does not have any side effects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is a static method?

A

A static method in JavaScript is a method that belongs to a class itself rather than to an instance of the class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is a class?

A

a class is a template for creating objects of a particular type. It defines the properties (attributes) and behaviors (methods) that the objects instantiated from the

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to cretae an instance of this class?

class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}

sayHello() {
console.log(Hello, my name is ${this.name} and I am ${this.age} years old.);
}
}

A

const person1 = new Person(‘John Doe’, 25);
person1.sayHello();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which are the propertes and methos od this object?

const person = {
name: ‘John Doe’,
age: 25,
sayHello: function() {
console.log(Hello, my name is ${this.name} and I am ${this.age} years old.);
}
};

A

In this example, the person object has two properties (name and age) and a method (sayHello).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

is a class intance same as an object?

A

Yes, in the context of object-oriented programming, a class instance and an object are essentially the same thing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is object-oriented programming?

A

Object-oriented programming (OOP) is a programming paradigm that organizes code based on the concept of objects, which are instances of classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is a stack
/pila?

A

a stack is an abstract data type that represents a collection of elements with a particular behavior known as last-in, first-out (LIFO). It is named “stack” because it resembles a stack of objects where new items are added to the top and removed from the top.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

three main phases of react lifycle

A

mounting, updating, and unmounting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

4 methods of mounting phase

A

constructor()
static getDerivedStateFromProps()
render()
componentDidMount()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

5 methods of Updating phase

A

static getDerivedStateFromProps()
shouldComponentUpdate()
render()
getSnapshotBeforeUpdate()
componentDidUpdate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

1 method of Unmounting phase

A

componentWillUnmount()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what are the purpose of hooks?

A

Hooks are a feature that allows developers to use state and other React features in functional components without the need for class components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what is jest?

A

Jest is a popular JavaScript testing framework developed by Facebook.

Jest is a testing framework that provides the overall test running infrastructure. It provides functionalities such as organizing your tests into suites and test cases, providing test doubles (mocks, spies, etc.), measuring code coverage, and offering utilities for assertions. Jest does not tie you to a specific way of testing and can be used with various testing approaches and libraries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

what is enzyme?

A

Enzyme is a JavaScript testing utility developed by Airbnb that provides additional testing capabilities for React components. It is often used in conjunction with Jest or other testing frameworks to facilitate the testing of React components in isolation. As of September 2020, Airbnb has officially announced that Enzyme development and maintenance have been discontinued.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

what is react testing library?

A

React Testing Library is a popular testing utility for React applications that promotes testing React components in a way that resembles how users interact with the application. It emphasizes testing components based on their rendered output and behavior rather than focusing on implementation details.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

prevState vs prevProps

A

prevState represents the previous state of a component, while prevProps represents the previous props of a component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

what is is truthy? 6

A

true: The boolean value true is obviously truthy.
Non-empty strings: Any string that contains at least one character is considered truthy.
Non-zero numbers: Any number that is not zero (positive or negative) is considered truthy.
Objects: Any object, including arrays and functions, is considered truthy.
Arrays: Arrays are objects in JavaScript, so they are also considered truthy.
Functions: Functions are objects as well and are considered truthy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

you can use square brackets [] to enclose the elements of …..

A

an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

you can use curly braces {} to enclose ….

A

an object.
const myObject = {
name: ‘John’,
age: 25,
city: ‘New York’,
isStudent: true,
};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

what is a fetch?

A

fetch is a built-in function used to make asynchronous network requests and retrieve resources from a specified URL. The fetch function takes a URL as its first argument and returns a Promise that resolves to the response of the request.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

how is a fetch structure? 3 parts

A

fetch(url)
.then(response => {
// Handle the response
})
.catch(error => {
// Handle any errors
});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

what is response.json in a fetch?

A

In the fetch function, the response.json() method is used to extract the response data as JSON. It returns a Promise that resolves to the parsed JSON data from the response body.

fetch(‘https://api.example.com/data’)
.then(response => response.json())
.then(data => {
// Handle the parsed JSON data
console.log(data);
})
.catch(error => {
// Handle any errors
console.error(‘Error:’, error);
});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

how is the json format?

A

it variaety that is why we have JSON.stringify() function is used to convert JavaScript objects into JSON strings, while JSON.parse() is used to parse a JSON string and convert it into a JavaScript object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

what is a script?

A

A script is typically used to automate tasks or perform specific operations. It can be written to interact with a system, manipulate data, control the behavior of a program, or perform various other functions.

Popular scripting languages include JavaScript, Python, Ruby, Perl, Bash, PowerShell, and many others.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

give an example of a class and class intances with a car

A

class Car:
def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year

def display_info(self):
    print(f"Make: {self.make}, Model: {self.model}, Year: {self.year}")

Creating car instances
car1 = Car(“Toyota”, “Camry”, 2020)
car2 = Car(“Honda”, “Civic”, 2018)
car3 = Car(“Ford”, “Mustang”, 2022)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Are objects same as class?

A

Objects are instances of a class created with specifically defined data. Objects can correspond to real-world objects or an abstract entity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

How does fetch works with a promise?

A

To get data using promises in JavaScript, you typically use the fetch() function, which returns a promise that resolves to the response of the HTTP request.

fetch(‘https://api.example.com/data’)
.then(response => response.json()) // Parse the response as JSON
.then(data => {
// Work with the data
console.log(data);
})
.catch(error => {
// Handle any errors that occurred during the request
console.error(‘Error:’, error);
});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

¿Qué es ESLint?

A

ESLint es una herramienta de código abierto enfocada en el proceso de “lintig” para javascript (o más correctamente para ECMAScript). ESLint es la herramienta predominante para la tarea de “limpiar” código javascript tanto en el servidor (node. js) como en el navegador.

“Linting” es un proceso que se realiza en la etapa de desarrollo para verificar el código y encontrar cualquier problema potencial. Un “linter” es una herramienta que se usa en este proceso.

El linter realiza varias comprobaciones en el código, como la detección de errores de sintaxis, errores de formato, errores de estilos de codificación y otros problemas posibles.

Un linter muy popular para JavaScript es ESLint. Puedes personalizar las reglas de ESLint según tus necesidades, lo que significa que puedes definir tus propios estándares de estilo de código y hacer que ESLint verifique el código en consecuencia.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is npm?

A

npm comes bundled with it.

With npm, you can:

Author your own Node.js modules (“packages”), and publish them on the npm website so that other people can download and use them

Use other people’s authored modules (“packages”)

So, ultimately, npm is all about code sharing and reuse. You can use other people’s code in your own projects, and you can also publish your own Node.js modules so that other people can use them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

Que es deploy?

A

Deployment is the mechanism through which applications, modules, updates, and patches are delivered from developers to users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What package.json is?

A

The package. json file is the heart of any Node project. It records important metadata about a project which is required before publishing to NPM, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

3 things to do with new code in j***s

A

The methods used by developers to build, test and deploy new code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Code in dev

A

-You can check which git commit the code has been put in dev from.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

Dev enviroment

A

A development environment in software and web development is a workspace for developers to make changes without breaking anything in a live environment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Production enviroment

A

A production environment is a real-time setting where the latest versions of software, products, or updates are pushed into live, usable operation for the intended end users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

You deploy to…

A

enviroments….
could be dev, uat, uat2…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What does j***s does?

A

you can deploy, is a pipeline that has a code commit source, then a build, a test and a deply to the desire enviroment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What are props? aka properties

A

which stands for properties and is being used for passing data from one component to another. But the important part here is that data with props are being passed in a uni-directional flow. IMMUTABLE BY CHILDS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

What is a state?

A

The state is a built-in React object that is used to contain data or information about the component. A component’s state can change over time; whenever it changes, the component re-renders.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

When a components re-renders?

A

React components automatically re-render whenever there is a change in their state or props.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

CONTEXT API- useContext
to avoid props drilling porblems to super grand childrends :(, like red hairs!

A

for global states

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

Example of useContext dark/light theme in an website

A

affect all the components and all components should known the state. Is a GLOBAL STATE.
SHARE Global data :)
Tipical, userPermission according to id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

GLOBAL STATES: You need (3)

A

-create a context
-useContext
-provider for the context
-then you can access from x component to that needed state of the context.
-you create a global state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

theme.provider or x.provider. What it does?

A

The Provider component accepts a value prop to be passed to consuming components that are descendants of this Provider.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

memoization, const value = useMemo(() => ({a, b}), [a, b]);

what is for?

A

avoiding unnecessary rendering when two props are the same but different objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Statefull component

A

Needs states, just like input of my fav coutries to live in!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

Stateless component

A

dosent have states, it could use props!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

props drilling! We hate… we fix with…

A

useContext :)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

uncontrolled component

A

is a component that maintains its own internal state. No component re-renders.
Browser DOM handles the changes to the element.

If you are using a form, you are NOT using setState to capture input. Instead you could be using useRef hook to capture node value, current.value. Is an state matain by the DOM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

controlled component

A

a controlled component is a component that is controlled by React state. Ex. form input use UseState to update input values and save it as internal state of the component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

array destructuring Example :)

A

Destructuring the array in JavaScript simply means extracting multiple values from data stored in objects and arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

object destructuring

A

Destructuring the array in JavaScript simply means extracting multiple values from data stored in objects and arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

object destructuring

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

array of objects, how to write it?

A

const array = [
{id:1, name: “Peter”},
{id:2, name: “John”}
]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

how to map over an array of objects and show the name?

{asianCountries.map(( x, y )=>
<ul>{xxx}</ul>)}

A

{asianCountries.map((country, id )=>
<ul>{country.name}</ul>)}

order of country and id,
country.name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

4 basic html things for a form:

A
  1. form
  2. label
  3. input
  4. button
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

useState hook from React, what is and what returns?

A

is a function that returns an array with two elements: the current state value (in this case, an object representing a car) and a function to update that state (in this case, setCar).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

what is APi?

A

es una interfaz que te permite “comunicar” cosas que hablan diferentes. Ej celular tipeo.

Las APIs comunican programas/sistemas entre si. Ejemplo integraciones, fb con ig, misma publicación.

Un API es un programa para ser usado por otro programa. Asi como en cualquier programa al tu interactuar con el , ingresando datos el programa te responde. Tu puedes hacer un programa que interactue con otro programa (API) y de esta manera tu programa disfrutara de los beneficios que le pueda ofrecer la AP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

pure vs impure functions

A

Pure Functions:
A pure function is a function that always returns the same output given the same inputs. It has no side effects, meaning it does not modify external state or variables, nor does it interact with the outside world (e.g., API calls, DOM manipulation).
Pure functions are predictable and easier to reason about since they only rely on their input arguments and have no hidden dependencies.
In React, pure functions are commonly used for components that are based solely on their props. Given the same props, they always render the same output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

useEffect when it renders?

A

By default, if no second argument is provided to the useEffect function, the effect will run after every render.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

what is a const with an arrow function in react?

A

a const with an arrow function refers to creating a constant variable that holds an arrow function. Arrow functions are a concise way to define functions in JavaScript, and they have a more compact syntax compared to traditional function expressions.

const sayHello = (name) => {
return ‘Hello ‘ + name;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

what is a function?

A

A function is a fundamental concept in programming and refers to a reusable block of code that performs a specific task or set of tasks. Functions help in organizing code into logical and manageable pieces, making it easier to read, write, and maintain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

inputs in fucntions are called…

A

arguments or parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

JS is syncronims or asyncronic?

A

Although it’s synchronous by nature, JavaScript benefits from asynchronous code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

Object.keys(user)

A

Object.keys(user) is a JavaScript method that is used to extract an array of keys from an object. In this context, it seems like user is an object, and Object.keys(user) is being used to check if the object has any properties (keys) or not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

single thread JS

A

Node.js runs JavaScript code in a single thread, which means that your code can only do one task at a time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

is fetching data a side effect?

A

fetching data from a third-party API is considered a side-effect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

what is AJAX? not football :)

A

AJAX = Asynchronous JavaScript

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

what is a reducer?

A

Components with many state updates spread across many event handlers can get overwhelming. For these cases, you can consolidate all the state update logic outside your component in a single function, called a reducer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q

when to use useReducer and useState

A

useState, it’s better to use it with primitive data types, such as strings, numbers, or booleans.

The useReducer hook is best used on more complex data, specifically, arrays or objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q

what is a custum hook?

A

A custom hook is simply a way to extract a piece of functionality that you can use again and again.
A custom hook is essentially a JavaScript function that starts with the word use and can call other hooks. By convention, hooks always start with the word use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q

when to use useReducer hook

A

alternative to useState, but updates different the state
manage its state with a reducer.
inspire in redux!
where the state logic is more complex and involves multiple sub-states or actions that affect each other. It can help to avoid prop drilling (passing state down through multiple layers of components) and can lead to more maintainable and predictable code.
Base on an action the state will increment or decrement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

const [state, dispatch], what is this called?

const [state, dispatch] = useReducer(reducer, initialState)

A

This is array destructuring in JavaScript. We are using it here to extract two values from the return value of the useReducer hook.

Extraes el stata y el dispatch del hook useReducer que devuelve un array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q

where I can find JSX?

A

JSX allows developers to write HTML-like code within JavaScript, making it easier to create and manipulate the UI components in React applications.

JSX is used in the return statement of a React component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q

what is used above the return in react?

A

JavaScript is commonly used above the return statement in a React component. The code above the return statement typically includes various JavaScript constructs,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q

what react does with components?

A

combines components to create a view/screen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q

what is a state?

A

values of variables you have on yoour components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

aim of npm

A

npm is all about code sharing and reuse. You can use other people’s code in your own projects, and you can also publish your own Node.js modules so that other people can use them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q

node.js why is needed?

A

React itself can be used without Node.js in the client-side browser environment, having Node.js installed can greatly facilitate the development, deployment, and overall build process when working with React projects.

-js is a language that can be run in the browser, but for that needs interpretation, js enginee or babel.

-you can use node js as a server side component and enables you to use javascript as a fullstack (front and back end)

-a javascript runtime enviroment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q

what is react (2)?

A

React is just a front-end library. You’re going to need to interact with other third-party libraries.

client-side library. You do need to figure out how you’re going to do routing and server client communication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q

which is react design philosphy?

A

component based arquitecture, for reusable component code

-colecction of components
-example: header, payment, sidebar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q

advantages of components? (3)

A

reusable
independent
stand alone parts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q

what is the DOM and how to edit it?

A

It represents a web page as a tree-like structure of objects. Each object corresponds to an HTML element or content on the page. Developers can use the DOM to interact with and modify the page’s content, structure, and style using JavaScript.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q

react virtual dom

A

tbd..

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q

functional components acts like…

A

js function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q

index.js what is load?

A

the app component. Aka main component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q

index.html to be done

A

tbd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
97
Q

All component names must be…

A

capitalized, bc lowecase is seen as html elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
98
Q

In return, variables, constants or states must be…

A

wrap around brackets {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
99
Q

JSX con be defined as a combination of…

A

css, html and js

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
100
Q

what is transpiling and what is babel?

A

-Babel: The React code, including JSX, is passed through Babel, a popular JavaScript transpiler.

-A browser cannot understand JSX syntax.

-A transpiler takes a piece of code and transforms it into some other code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
101
Q

what is ES6?

A

JavaScript ES6 (also known as ECMAScript 2015 or ECMAScript 6) is the newer version of JavaScript that was introduced in 2015.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
102
Q

what is a website navegation?

A

refers to the process of navigating or moving through a website to find and access its various pages, content, and features. From component to component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
103
Q

examples of navegation components?

A

navbar with icons

104
Q

How many divs render one react app?

A

entire react app is loaded inside one div and index.js.

The content of that div is controlled by react.

105
Q

Example of navegation with react elevator..

A

You press 6 and that floor aka component is render :)

106
Q

What is bundling?

A

When the browser requests the application, return and load all necessary HTML, CSS and JavaScript immediately. This is known as bundling.

107
Q

what is react routing library?

A

-is same as react-router-dom
-first thing, import BROWSERROUTER
-wrap your app with broserRouter, in index.js
-from you app component, import routes, route
-in your app return use first <Routes> and then <Route></Route></Routes>

108
Q

what is transpiling and babel?

A
  1. For React code to be understood by a browser, you need to have a transpiling step in which the JSX code gets converted to plain JavaScript code that a modern browser can work with.
  2. Babel is a JavaScript Compiler.

What Babel does is this: it allows you to transpile JSX code (which cannot be understood by a browser) into plain JavaScript code (which can be understood by a browser).

109
Q

what is the index.html file?

A

the index.html file plays a critical role as it serves as the entry point of the React application

110
Q

8 points of index.html file.

A

<!DOCTYPE html>: This declaration specifies that the document is an HTML5 document.

<html>: The <html> element is the root element of the HTML page. The lang attribute indicates the language of the document, which is set to "en" for English.

<head>: The <head> element contains meta-information about the HTML document, such as the character encoding and viewport settings.

<meta></meta>: This meta tag specifies the character encoding for the document, typically set to UTF-8 to support a wide range of characters.

<meta></meta>: The viewport meta tag sets the initial width and scale of the web page, ensuring proper responsiveness on different devices.

<title>React App</title>: The <title> element sets the title of the web page, which appears in the browser's title bar or tab.

<body>: The <body> element contains the visible content of the web page.

<div></div>: This <div> with the id attribute "root" is where the React application is mounted and rendered. React uses this element as a target to inject its components and manage the application's UI.
</div></body></body></title></head></head></html></html>

111
Q

conection of babel, webpack and index.html

A

You write a React component: const App = () => <div>Hello World</div>;.
Babel takes this JSX and transpiles it into JavaScript that browsers can understand.
Webpack bundles this transpiled code (along with any other modules and assets) into bundle.js.
When users visit your website and load the index.html, the browser fetches and executes bundle.js.
The executed code mounts the React app inside the <div id="root"></div> in index.html.

El index.js (u otro archivo de entrada que hayas definido) es el punto de partida de tu aplicación. Es donde empiezas a escribir tu código y desde donde importas otros módulos o archivos.

Cuando usas una herramienta como Webpack, toma ese archivo de entrada (index.js), sigue todas las importaciones para incluir todos los módulos necesarios, y luego los “empaqueta” todos juntos en un solo archivo, que generalmente se denomina bundle.js.

Start building with index.js.
Use Babel to make sure all the pieces fit.
Pack everything with Webpack into a bundle.js.
Place and showcase it in index.html.
When a user opens the index.html, the bundled code from bundle.js executes, bringing your application to life.

112
Q

what about the index.js file?

A

the index.html file provides the basic structure and a target container (<div id="root"></div>) for React to render the application, while the index.js file is responsible for importing the necessary components, rendering the main component (<App></App>), and initiating the React rendering process within the designated container in the index.html file.

113
Q

what are modules in js?

A

units of code that can be reuse.

114
Q

what is modular programming?

A

when you split you code into modules, that are similar but no exaclty the same as components.

115
Q

one direction data flow

A

props pass from father to childs, no other way around.

116
Q

curle brackets lets you escape…

A

jsx and get into js. So with {} you can access all your js

117
Q

() is needed in the return when,

A

you only return more than one line in html.

118
Q

html code in the return must be wrapped around

A

a top level tag as div or an empty fragment <> </>

119
Q

what npm does?

A

has a database of modules realted to node js.
-Node Package Manager, is an essential tool for many JavaScript and Node.js developers

120
Q

what is runtime enviroment? Ex node js.

A

Example: Node.js

Node.js is a runtime environment for JavaScript.

JavaScript Code: Think of this as a music sheet.
Node.js: Think of this as the musician who can read the music sheet and play the music.
Before Node.js, JavaScript could mainly be played in browsers (like Chrome, Firefox). But with Node.js, you can now play (or run) JavaScript outside of the browser, such as on a server or in your computer’s terminal.

121
Q

what is a children?

A

is a shortcut for props.children and means you dont know which children you are expecting to come, so is like a generic prop.

122
Q

how to style react?

A

add a className, and code it on a style.css sheet normally.
Do it inline style= {{color: red, backgroundColor: blue}}, with an object!,

123
Q

inline style in react (2)

A

is an OBJECT
each style is divided with COMA,
inside the object
and HIFFEN replace by camelCase,
reference must be a “string” bc we are working on an object

124
Q

Ways of declaring a react component

A

-function Name (props){}

-const Name =function (props) {}

const Name = (props) => {}

with arrow aka annonymous function

125
Q

ternary operator, what it is?

A

username === “Gabby” ? console.log(“Hello, Gabby!”) : console.log(“Hello, Frien”)

condition ? true : false

126
Q

when to use $ in js and react?

A

let name = ‘John’;
console.log(Hello, ${name}!); // Output: “Hello, John!”

In this case, ${name} is replaced by the value of the name variable. This is not actually $ being used as a variable, but rather it is part of the ${…} syntax for embedding expressions within template literals.

127
Q

can I call a function inside the return? How?

A

Yes, you can. For so, you must escapte jsx, with {}

128
Q

working with props. What is object descontructing?

A

props come altogther as objects.

When you pass props to a component, they are received as an object, and each prop is a property on that object.

129
Q

is react declarative?

A

React is considered a declarative framework

In other words, in declarative programming, you simply declare the desired results, and you don’t have to describe step-by-step how to get the results. The system figures out the mechanics of how to arrive at the result.

130
Q

what is react?

A

open-source JavaScript library for building user interfaces, -

particularly single-page applications.

It’s maintained by Facebook

131
Q

what is a JSON?

A

-JavaScript Object Notation
-{
“name”: “John Doe”,
“age”: 30,
“isStudent”: false,
“courses”: [“math”, “english”, “computer science”],
“address”: {
“street”: “123 Main St”,
“city”: “Springfield”,
“postalCode”: “12345”
}
}

132
Q

what are events?

A

that events are the process by which JavaScript interacts with HTML and can occur when the user or the browser manipulates a page.

133
Q

3 ways to invoke an onEvent in react

A

function handleClick(){
console.log(“Hello, I’m a function outside of the click event!”)
}
return (
<div>
<button onClick={function(){ console.log(“Hello, anonymous function!”)}}>
Hello, anonymous function!
</button>
<button onClick={() => { console.log(“Hello, arrow function!”)}}>
Hello, arrow function!
</button>
<button onClick={handleClick}>
Hello, outside function!
</button>

  1. outside
  2. arrow function
  3. as function
134
Q

using arrow function onClick

A

Preventing the function from running immediately: If you write onClick={myFunction()}, myFunction will be executed as soon as the component mounts, not when the button is clicked. To delay the function execution until the click event occurs, you need to wrap the function call inside an arrow function: onClick={() => myFunction()}.

135
Q

difference between onClick={function} and onClick={function()}

A

If you had written onClick={handleClick()}, then the handleClick function would be invoked immediately upon mounting, which is not typically the desired behavior for event handlers.

136
Q

data in react is ………. and its day when is pass from parent-child-grandchild-…. is called …

A

. unidirectional
.levels of nesting

137
Q

the parents is also know as the ….

A

root component

138
Q

two main ways to work with data in react

A

props that are recived and do not mutate unless parent does,

and states, that mutate, from component itself

139
Q

explain what is a statefull and stateless component and their purpose or change if you have or not one

A

….

140
Q

why prop drilling is bad? how could it be solved?

A

“Prop drilling” refers to the process where you pass data from one part of the React component tree to another by going through other parts that do not need the data, but merely pass it along.

Can be easily solved using import React, { createContext, useContext } from ‘react’;. aka react context API

141
Q

what is a context consumer? react context API

A

Any component that uses the state provided by context API

142
Q

what is JSON used for?

A

transmitting data between a web server and client.

-standard format for data exchange
-Ej. validating username

143
Q

which data can be passed on props? 3

A

states
values
functions

144
Q

how navegation works in react? which library aka dependency is needed?

A

as a single page app,
reacts renders in the same page, the single route.
-it needs react router library

145
Q

does an ancher tag with a link works in react for navegation?

A

no, it dosent. Those are “broken links”.

146
Q

steps to install navegation in react (4)

A
  1. insert browserRouter warpiing the app
  2. inser individual route
  3. wrap all the route with routes tag
  4. To link a btn or menu to route, use the Link component
147
Q

what are asserts?

A

any file needed by your app, could be images, stylesheets, fonts

148
Q

if your component dosent need an asset, where should I store it?

A

in public folder, same as favicon does. Otherwise creta an assert folder for those needed for your component must load.

149
Q

what is a dependency graph?

A

a dependency graph is a conceptual representation of the relationships between different modules in your application. It essentially shows which modules depend on others. Related to bundle and webpack

150
Q

what webpack does?

A

The bundler (like Webpack or Parcel) starts at the entry point of your application (usually an index.js or main.js file), and follows all the import statements to build a complete picture of how your modules depend on each other. This picture is the dependency graph.

-So, webpack builds a dependency graph and bundles modules into one or more files that a browser can consume.

151
Q

client-side rendering and server-side rendering, tbd

A
152
Q

how to embed videos?

A

-react-player
check npm packeages,
check updates frequencies
github page

153
Q

why we need jest + RTL in the testing ecosystem?

A

Jest is a testing framework that provides the overall test running infrastructure. It provides functionalities such as organizing your tests into suites and test cases

React Testing Library (RTL) is a library for testing React components in a way that resembles how users would interact with your application.
RTL doesn’t provide a test running infrastructure, it is just a tool for writing effective tests for React components.

-You could think of Jest as the engine that powers your tests, while React Testing Library is a toolkit for writing specific kinds of tests (React component tests, in this case).

154
Q

what is an element?

A

element is a plain object that describes a component instance or a DOM node and its desired properties. It’s a light, stateless, and immutable description of what you want to see on the screen. An element is what React uses to construct and update the DOM or the native components if you are using React Native.

155
Q

React children as props. What is specialization?

A

Specialization defines components as being “special cases” of other components.

156
Q

React children as props. What is Containment?

A

Containment refers to the fact that some components don’t know their children ahead of time.

157
Q

component composition technique with children

A
158
Q

testing ad

A

-finding bugs
-save money and time

159
Q

what the test interacts with?

A

react dom

160
Q

jest

A

js test runner
gives access to jsdom

161
Q

why do we need to finish with test.js a test file?

A

so Jest when it runs the test knows and find it

162
Q

Continuous Integration (CI)

A

is a software development technique in which developers use a version control system, like Git, and push code changes daily, multiple times a day. Instead of building out features in isolation and integrating them at the end of the development cycle, a more iterative approach is employed.

-Each merge triggers an automated set of scripts to automatically build and test your application. These scripts help decrease the chances that you introduce errors in your application.

163
Q

CI Pipeline

A

When new code enters one end, a new version of the app gets built automatically, and a suite of automated tests is run against it.

-A developer from the team creates a new branch of code in Github, performs changes in the code, and commits them.

When the developer pushes its work to GitHub, the CI system builds the code on its servers and runs the automated test suite.

Suppose the CI system detects any error in the CI pipeline. In that case, the developer who pushed the code gets a notification.

if the status is green and all goes well, the pipeline moves to its next stage, which usually involves deploying a new version of the application to a staging server. This new version can be used internally by the Quality Assurance (QA) team to verify the changes in a production-like environment.

164
Q

what are styles guide while developing?

A

improves usability, readiabiilty, mainteince.

165
Q

what is a compoennt?

A

function that takes data or props as input and return a tree of elemetnts as output.

166
Q

what are elements?

A

plan js objects, that make a representation of the dom and let react update the user interface fast.

167
Q

what is a tree of elements?

A

the main react object where app gets renders and all the subsequents components aka the childs, generating a tree of objects. All this are js objects

168
Q

virtual and real dom explanation

A

reacts creates this objects and a tree of objects in js. That tree is in memory of react, aka the virtual dom.
So virtual and real dom needs to be sync.

169
Q

how to update old real tree with small changes detected when comparing with virual dom. How to compare and update?

A

with diffing alforithm. Diffing aka differenciting the tree!
We dont want to re render the whole tree! Its huge and expensive!

170
Q

React.cloneElement

A

allows you to create a copy of a specific element while preserving its props and children. This cloned element can then be given new props to extend or override the props of the original element.

171
Q

React.children.map

A

iterate over the children of a component and perform an operation on each individual child. It is very similar to the JavaScript Array.map function, but React.Children.map takes into account that props.children may be an array or a single item.

172
Q

spread operator …

A

make it simplier :)

173
Q

Cross-cutting

A
174
Q

Higher Order Component

A
  • HOCs are a way to reuse component logic. Specifically, a HOC is a function that takes a component and returns a new component.

-A HOC transforms a component into another component. In other words, it enhances or extends the capabilities of the component provided.

-withLogging is a HOC

175
Q

How to map over an array comming by props…

<ul>
{props.name.map((--------------------) => (
-----------------------
))}
</ul>

A

<ul>
{props.name.map((eachm, index) => (
<li>{eachm}</li>
))}
</ul>

176
Q

what the with part of a HOC represents? 2 examples

A

The with part of the HOC name is a general convention recommended by React, as it expresses the enhancing nature of the technique, like providing a component ‘with’ something else.
-login
-subcription

177
Q

render props and HOC, what are thoughts about it?

A

Since the introduction of hooks in React, the need for render props (and higher-order components) has greatly decreased. A lot of the patterns where we formerly used these techniques can now be done more straightforwardly with hooks.

178
Q

what are axios and fetch?
1 =, 2 dif

A

-both ways to make HTTP requests in JavaScript
-hey have different APIs and different features.
-Parsing JSON: Axios automatically transforms JSON data into JavaScript objects. With Fetch, you need to call the .json() method on the Response object to transform the data into a JavaScript object.

179
Q

axios basic structure

  1. axios.——()
    .———————–
    .————————-
    .————————-
A

axios.get(‘https://api.example.com/data’)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(‘Error fetching data: ‘, error);
})
.finally(() => {
console.log(‘Finished fetching data’);
});

180
Q

what is finally used for in fetch or axios?

A

.finally() method to specify what should happen when the Promise has finished, whether it was fulfilled or rejected. In this case, we are logging a message to the console.

181
Q

what is jQuery?
main function it has

A
  • jQuery is a JavaScript library
    -the $ function is a central part of jQuery. It can select HTML elements, create HTML elements, handle events, and perform other useful tasks.
182
Q

what is oracle db and connection with sql developer?

A

-It’s one of the world’s leading relational database management systems (RDBMS). The database software allows you to store, manage data.
- With Oracle SQL Developer, you can connect to an Oracle Database instance. You can connect using the network alias of the Oracle database, or you can use the hostname, port number, and SID/service name to connect. Once connected, you can create, modify, and delete database objects such as tables, views, indexes, sequences, procedures, functions, and packages

183
Q

what is typescript? basic answer

A

-is a programming language that works on top of js and help you detect errors before going and running your app. In the develop stage

184
Q

Math.floor(Math.random() * 5), explain what is doing? remeber your phrases making…

A
  1. math ramdom choose a random number within 5, 2. as that number could have decimals and I need a integer
  2. math.floor, lo redondea.
185
Q

what is ag grid?

A

datagrid library for js
It’s a component used for displaying tabular data in a series of rows and columns. for data grid

186
Q

how is basic ag grid with — and —? how is the component gonna be render?

A

<AgGridReact
columnDefs={columns}
rowData={rowData}
/>

187
Q

what are grid options in ag grid?

A

Grid Options: properties and callbacks used to configure the grid, e.g. pagination = true and getRowHeight(params).

Pagination Options:

pagination: Set to true to enable pagination.
paginationPageSize: Number of rows per page.
domLayout: Set to ‘autoHeight’ for the grid to adjust its height based on rows inside it.
Sorting and Filtering:

enableSorting: Allow column sorting.
enableFilter: Allow column filtering.
defaultColDef: A default column definition. All its properties will be applied to every column.
Styling:

rowClass: Add custom class(es) to rows.
rowStyle: Dynamic styles based on row data.
Events:

onRowClicked: Event fired when a row is clicked.
onCellEditingStarted: Event fired when cell editing starts.
onCellEditingStopped: Event fired when cell editing stops.

188
Q

react query

A

is a library that gives React JS the state management ability for any kind of asynchronous data.}
useQuery is a custom hook

189
Q

A useQuery hook requires two arguments., which are…

A

The first one is a key for the query. I’m using the string “users” for that.
The second one is a function to fetch the data. I put the fetchUsers asynchronous function I created earlier.

190
Q

what is return in an useQuery hook?

A

Data is the actual data we fetched, and status will either be loading, error, success or idle, according to the response.

191
Q

name 5 properties in the return of a useQuery:

A

data,
error,
failureCount,
isError,
isFetchedAfterMount,
isFetching,
isIdle,
isLoading,
isPreviousData,
isStale,
isSuccess,
refetch,
remove,
status,

192
Q

what happens when you type an url into a brownser and you hit enter?

A

you type a URL into a browser and hit enter, the following simplified steps occur:

DNS Lookup: The browser first checks if it already knows the IP address associated with the domain. If not, it queries a Domain Name System (DNS) server to translate the URL’s domain name (like www.example.com) into an IP address.

Browser Request: The browser sends a request to the web server at the identified IP address, asking for the content associated with the URL.

Server Processing: Depending on the website, the server might need to run some scripts (like querying a database) to prepare the content that needs to be sent back.

Data Transmission: The server sends the requested data back to the browser, usually in the form of HTML, CSS, JavaScript, and possibly media (images, videos, etc.).

Browser Rendering: The browser processes the received data and displays the webpage on your screen. This includes interpreting the HTML, CSS, and JavaScript to generate the visible content and any interactive elements.

193
Q

what is an outer function?

A

function outerFunction() {
let outerVariable = “I’m from the outer function!”;

function innerFunction() {
    console.log(outerVariable);  // This inner function has access to the outerVariable
}

return innerFunction; } . In this context, "outer function" simply refers to the function that wraps or encloses the inner function.
194
Q

what is closures in js?

A

The inner function has access to variables from its enclosing scope (i.e., outerVariable). This capability demonstrates the concept of closures in JavaScript.

function outerFunction() {
let outerVariable = “I’m from the outer function!”;

function innerFunction() {
    console.log(outerVariable);  // This inner function has access to the outerVariable
}

return innerFunction; } .
195
Q

difference between map and foreach in js

A

are methods available on arrays in JavaScript, and they both iterate over the items in the array.

-map: Transforms each element of the array and returns a new array with the transformed elements. The original array remains unchanged.
forEach: Executes a given function on each element of the array for side effects. It does not return a meaningful value (it returns undefined).

196
Q

como se le dice a un array? en spanish sil vou ple

A

lista

197
Q

columnDef is an array?

A

columnDefs is an array of objects where each object defines the properties of a column in the grid.

Each object in the columnDefs array corresponds to a column.

198
Q

what is field and headerName?

A

The headerName property determines what is displayed in the column header.
The field property binds the column to a specific field in the row data.

199
Q

what is rowData?

A

rowData is an array.
Each item in the array represents a row in the grid,
and each item is typically an object
where the keys correspond to column fields and the values are the data for those columns.

const rowData = [
{ make: “Toyota”, model: “Celica”, price: 35000 },
{ make: “Ford”, model: “Mondeo”, price: 32000 },
{ make: “Porsche”, model: “Boxster”, price: 72000 }
];

200
Q

cellRenderer functionality in ag-Grid

A

customize how data in a cell is displayed. You can provide a function, a React component, or a string that points to a predefined renderer.

201
Q

In ag-Grid, gridOptions is

A

object that provides configuration for the grid. It’s essentially the “settings” of your grid, where you define various properties and event callbacks to customize the behavior and appearance of your ag-Grid instance.

202
Q

gridRef = useRef()

A

you’re creating a ref with React’s useRef hook, which is used to access and interact with DOM elements or component instances directly within functional components.

203
Q

the line let updatedData = […rowData];

A

is used to create a shallow copy of the rowData array.

204
Q

un objecto tiene ———— y su correspondiente ———–

A

keys and properties.

Object.keys() is particularly useful when you want to iterate over an object’s properties, or when you need to determine the number of properties in an object without iterating through them.

205
Q

strongly typed or statically typed. Ex of one that is and one not

A

When a programming language requires you to specify a data type for a variable (or function return type, parameter type, etc.).
is c#
not Python, JavaScript

206
Q

The method return type is void

A

which means it doesn’t return any value. However, you’re trying to return a string.

207
Q

Object.keys() in js.
what will return?

const object = {
a: ‘value1’,
b: ‘value2’,
c: ‘value3’
};

const keys = Object.keys(object);

A

console.log(keys); // [‘a’, ‘b’, ‘c’]

208
Q

Object.values() in js.
what will return?

const object = {
a: ‘value1’,
b: ‘value2’,
c: ‘value3’
};

const values = Object.values(object);

A

console.log(values); // [‘value1’, ‘value2’, ‘value3’]

209
Q

If I need the keys and values from an object, what can I use?

A

const entries = Object.entries(object);
console.log(entries);
// [[‘a’, ‘value1’], [‘b’, ‘value2’], [‘c’, ‘value3’]]

210
Q

How is row and columns related in ag grid?

A

By filed in column

const rowData = [
{name: “John”, age: 28, gender: “Male”},
{name: “Jane”, age: 22, gender: “Female”},
{name: “Doe”, age: 31, gender: “Non-Binary”}
];

const columnDefs = [
{headerName: “Name”, field: “name”},
{headerName: “Age”, field: “age”},
{headerName: “Gender”, field: “gender”}
];

211
Q

if I set an state, and I need the old data and Add new one, what you should do?

A

…prevMessages, newMessage

212
Q

I need something to happen if I go into a then and something else if I go into a catch?
Should I put that logic into a variable and then do it in the code or what?

A

No, your logic must be inside the then and the catch.
Promesis are asyncronic, which means we dont know exacly when it happens, so we must put the logic inside it.

213
Q

How to destructure something like

function (params)
params.value?

A

function({value})

214
Q

besides params, what are arguments?

A

arguments is something else passed by the father. So the params is like one of the things is passed by, some other “params” could be being passed too.

215
Q

check if something is inside a list without condicional methods. What can be used, not for objects.

A

includes.

checking for simple values like strings or numbers in an array. However, for objects, two objects with the same properties and values are considered distinct unless they reference the exact same object.

216
Q

check if something is inside a list without condicional methods. What can be used, FOR special case OBJECTS.

A

The some method checks if at least one item in the array meets the condition specified in a callback function.

some.

some stops iterating as soon as it finds a match.
When you use some, you’re directly checking each object in the array for a match.

The some method itself doesn’t compare objects. Instead, it iterates over the array and applies the callback function you provide to each element

217
Q

What Is Memoization?

A

Memoization is when a complex function stores its output so the next time it is called with the same input.

218
Q

useCallback vs useMemo, when to use each one?

A

The key difference is that useMemo returns a memoized value, whereas useCallback returns a memoized function.

219
Q

Explain the useEffect hooks, when it triggers, how is composed and what returns.

A
220
Q

Explain functional components cycle and related that with useMemo and useCallback

A
221
Q

What is an object? in js

A

a collection of properties where each property has a key and a value.

222
Q

what is a call stack? how it works?

A

The call stack is used by JavaScript to keep track of multiple function calls.

223
Q

can you use map over an json data structure?

A

No.

Object.values(jsonObject).map(value => value.name);

224
Q

how to retun data when you are using map? do I need {}?

A

Depends.

Object.values(jsonObject).map(value => value.name);

this is equal but no needed bc is only one line return

Object.values(jsonObject).map(value => {return value.name});

225
Q

why I dont need the {}? Object.values(jsonObject).map(value => value.name);

A

No, you don’t necessarily need to use the return keyword if you’re using arrow functions with a concise body. In arrow functions, the value after the => is implicitly returned if you omit the curly braces ({}).

226
Q

How to add a property to an object? Object.values(jsonObject).map(value =>———–);

A

Object.values(jsonObject).map(obj => {
obj.newProperty = “newValue”;
return obj;
});

227
Q

where should be brackers be in js {}

if(){
———-}else{
———-};

A

if(){
———-}else{
———-};

228
Q

how to merge by terminal?

A

go to master, fetch changes.
go back to your branch
In terminal git merge

229
Q

undestading hooks like useMemo and useCallback with memory

A

https://www.youtube.com/watch?v=3cYtqrNUiVw&ab_channel=JustinKim

230
Q

using reduce in js

A
231
Q

SOLID with react

A

Single Responsibility Principle (SRP):

Definition: A class should have one, and only one, reason to change.
In React: Each React component should have a single responsibility. That is, each component should represent one piece of a UI or handle one specific task. If you find that your component is becoming too complex, it’s often a sign that it should be broken down into smaller, more focused components.
Open/Closed Principle (OCP):

Definition: Software entities should be open for extension but closed for modification.
In React: Use component composition and Higher Order Components (HOCs) to extend the behavior of existing components without modifying their internal implementations. The idea here is to build components in such a way that new functionalities can be added without altering existing code, which can be achieved through props and composition.
Liskov Substitution Principle (LSP):

Definition: Subtypes must be substitutable for their base types without altering the correctness of the program.
In React: While React mainly deals with components rather than traditional inheritance structures, the principle can be applied in terms of prop contracts. If a component expects a certain prop type or shape, any data or component you pass in as that prop should adhere to the same contract. PropTypes and TypeScript can be helpful tools to ensure this.
Interface Segregation Principle (ISP):

Definition: Clients should not be forced to depend upon interfaces they do not use.
In React: It’s more about the component API. Components should have props that make sense for their use and not additional props which are unrelated to their function. Essentially, do not overload a component with unnecessary props or methods.
Dependency Inversion Principle (DIP):

Definition: High-level modules should not depend on low-level modules. Both should depend on abstractions.
In React: Dependency injection can be a bit tricky in React because React’s component-driven architecture is a bit different from traditional OOP. However, React’s Context API and certain state management libraries allow you to invert dependencies by providing required dependencies through context or global state, decoupling child components from their parents.

https://www.youtube.com/watch?v=MSq_DCRxOxw&ab_channel=CoderOne

232
Q

hooks review

A

https://www.youtube.com/watch?v=9mTgKFjJRXg&ab_channel=developedbyed

233
Q

Que es un json?

A

JSON está constituido por dos estructuras:
* Una colección de pares de nombre/valor. En varios
lenguajes esto es conocido como un objeto,
registro, estructura, diccionario, tabla hash, lista de
claves o un arreglo asociativo.
* Una lista ordenada de valores. En la mayoría de los
lenguajes, esto se implementa como arreglos,
vectores, listas o secuencias.

234
Q

what babel does?

A

Babel: Think of Babel as a translator.
Some parts of your sci-fi novel use a futuristic language (new JavaScript features or JSX) that not everyone understands. Babel translates (or transpiles) your novel into plain English (older JavaScript) so that a wider audience (all browsers) can understand and enjoy it.

Babel converts newer JavaScript and JSX into older JavaScript so that it can run in any browser.

235
Q

what webpack does?

A

Webpack: Now, instead of releasing your novel as one big book, you decide to split it into several smaller books (modules) – each focusing on a specific part of the story. This makes it easier for you to write and organize, but readers generally want a single book to read. Webpack is like a bookbinder that takes all these smaller books (modules) and combines them into one cohesive book (bundle) for the readers.

236
Q

relationship with index.html and index.js

A

index.html: Think of this as the theater stage. It’s an empty platform waiting for a performance. There’s a spotlighted area in the center of the stage, which we can call “root.” This is where the main act (our React app) will perform.

index.js: This is like the director of the play. The director decides which play (React app) will be performed and ensures it happens right in the spotlighted “root” area of the stage. The director instructs the actors (components) to start the play on the stage.

So, the index.html provides the “hook” or the “connection point” for the JavaScript to latch onto and start rendering the React components, turning an empty stage into a full-blown performance.

237
Q

que hace Jenkins ?

A

Detecta Cambios: Cada vez que un trabajador (desarrollador) crea o modifica una pieza (código), Jenkins lo nota.

Prueba las Piezas: Antes de que la pieza se integre al producto final, Jenkins la verifica (compila y prueba) para asegurarse de que todo está bien y no hay errores.

Arma el Producto: Si todas las piezas pasan la verificación, Jenkins las ensambla en un producto (una versión de la app) listo para ser entregado.

Notificaciones: Si Jenkins encuentra un problema con alguna pieza, avisa al trabajador (desarrollador) para que lo corrija.

Automatización: Jenkins hace todo esto automáticamente cada vez que detecta cambios, asegurándose de que el producto (la app) esté siempre en buen estado y listo para ser entregado al cliente o usuario.

En resumen, Jenkins es como un supervisor automático que se asegura de que todo se haga bien y rápidamente en la fábrica de apps.

238
Q

que es un pipeline?

A

Pipelines:

Jenkins permite la creación de “pipelines” o tuberías, que son una serie de pasos automatizados que el código debe seguir desde que se envía hasta que se despliega.
Estas tuberías pueden ser tan simples o complejas como se requiera, incluyendo fases de compilación, prueba, despliegue, y otros pasos personalizados.

239
Q

que es mandar un app a producción?

A

Mandar una app a producción se refiere a desplegar una versión de la aplicación en un entorno donde los usuarios finales pueden acceder y usarla. Jenkins, gracias a su capacidad de entrega continua (CD), puede automatizar este proceso.

240
Q

git, github, bitbucket

A

Git: Como mencionamos, es el diario mágico que ayuda a los programadores a llevar registro de todos los cambios en su código.

Bitbucket: Es una caja fuerte en la nube donde se pueden guardar y compartir esos diarios mágicos. Ofrece algunas herramientas extra, especialmente si trabajas con otros productos de Atlassian.

GitHub: Es otra caja fuerte en la nube, similar a Bitbucket, pero con sus propias características y herramientas. Es muy popular y ha desarrollado una gran comunidad alrededor. Piensa en ello como una biblioteca gigante donde mucha gente guarda y comparte sus diarios mágicos. Además de almacenar y compartir, ofrece herramientas para colaborar, discutir y mejorar esos diarios (código) junto con otros.

Ambos, Bitbucket y GitHub, hacen esencialmente lo mismo: son servicios que alojan repositorios Git.

241
Q

what indesOf does?

A

indexOf es un método de los arrays en JavaScript que retorna el primer índice en el que se encuentra un elemento dentro del array, o -1 si el elemento no se encuentra.

242
Q

Los tres elementos que puede usar un map u otro metodo

A

La funcionTransformadora es una función que toma tres argumentos:

elementoActual: el elemento actual del array que está siendo procesado.
indice: el índice del elemento actual en el array.
array: el array original sobre el que se llama map.

243
Q

Cuales son los parametros de map?

A

Lo que colocas entre paréntesis en la función que proporcionas a .map() representa los argumentos que esta función recibirá. En el contexto del método map, estos argumentos son:

elementoActual: El elemento actual del array que está siendo procesado.
indice: El índice del elemento actual en el array.
array: El array original sobre el que se está llamando map.

244
Q

Proque hay veces que el .map . filter no usan el return?

A

Cuando trabajas con métodos como .map(), .filter(), y otros métodos de arrays, las funciones de flecha sin llaves son comunes porque hacen que el código sea más conciso.

Sin embargo, si necesitas realizar múltiples operaciones o declaraciones dentro de tu función, es probable que desees usar llaves y return:

245
Q

Caso de uso del indexOf

A

indexOf(valor) devuelve el índice de la primera aparición del valor en el array. Si tienes múltiples apariciones de un valor, indexOf siempre te dará el índice de la primera aparición.

Durante la iteración de filter, para cada valor, se verifica si el índice de la primera aparición del valor (array.indexOf(valor)) es igual al index actual. Si es igual, significa que estás viendo la primera aparición de ese valor en el array, por lo que lo conservas. Si no es igual, estás viendo una aparición duplicada, por lo que no lo conservas.

246
Q

how to use filter method? what is expecting?

A

filter method on an array, it’s expecting a Boolean value (true or false) to determine whether to keep or remove an item from the filtered result. Returning anything other than a Boolean will lead to unexpected results.

247
Q

how to debug in react?

A

cuando sale un error y no es especifico,
del return is comentado y sacar cosas (rami)

248
Q

useState what it does? example

A

-react hook
-A Hook is a special function that lets you “hook into” React features.
-create a variable with an state
-save it and update it when needed
-when states changes it rerenders the component

-example if the counter/contandor

249
Q

useEffect

A

React allows you to perform side effects in function components. Side effects could be anything from data fetching

250
Q

define a hook

A

hooks are indeed functions, but they come with a few important rules and characteristics that distinguish them from regular JavaScript functions:

They can only be called from function components
They encapsulate logic
They start with the word “use”: By convention, all hooks should start with the word “use”. This convention makes it easier to identify hooks in the codebase.

251
Q

useMemo or cache a value

A

-es como useEffect pero guarando un valor, que se vuelve a calcular segun la depedencia si cambia

useMemo returns a memorized value. You give it a function that computes a value, and a list of dependencies. The value will only be recomputed when one of the dependencies has changed since the last render. Otherwise, useMemo will return the previous value.

In the second version, the filtering is only recalculated if items or filterText change. Otherwise, the filtered value from the previous render is reused. This can save time if the filtering process is computationally intensive.

252
Q

useCallback or cache a function

A

las funciones en cada render se vuelven a buildear. En memoria se vuelven a crear por cada render.

253
Q

TypeScript

A

https://www.youtube.com/watch?v=HCXPJmtV47I&ab_channel=Daniel-SelfMadeProgrammer

254
Q

Absolute vs relative path. We use ABSOLUTE

A

Relative Paths:

Definition: A relative path specifies the location of a file or module relative to the current file. It starts with either a dot (“.”) for the current directory, two dots (“..”) for the parent directory, or a combination of both and folder names.

Absolute path
// Assuming MyComponent.js is located at the root of the project
import MyComponent from ‘/src/components/MyComponent’;

255
Q
A