Fichas
React
Fichas del conjunto (7)
- 1What does useState() give us?The first variable is the value. Similar to this.state
The second variable is a function to update that value. Similar to this.setState - 2The useState argument is ?the initial state value. for example, our counter,can started at 0.
const [count, setCount] = useState(0); - 3what is React Hooks?Con la nueva característica de React, llamada Hooks, podremos utilizar los componentes funcionales para sacar todo el potencial a la librería. Algo que, hasta hace poco, sólo era posible con las clases.
Los Hooks son una nueva API de la librería de React que nos permite tener estado, y otras características de React, en los componentes creados con una function. - 4how to import use State APIimport React, { useState } from 'react';
- 5Como se implementa multiples estados de variables con react hooks?import React, { useState } from 'react';
function AllTheThings() {
const [count, setCount] = useState(0);
const [products, setProducts] = useState([{ name: 'Surfboard', price: 100 }]);
const [coupon, setCoupon] = useState(null);
return {/_ use all those things here _/}
;
} - 6This is what the Effect Hook is for?Side-effects are things you want your application to make like:
Fetching data
Manually changing the DOM (document title)
Setting up a subscription - 7—
Información
- Descripción
- Fichas sobre React, creado por Amber JS el 30/07/2019.
- Creado por
- Amber JS
- Visitas
- 10
- Etiquetas
- Valoración