Question | Answer |
What 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 |
The useState argument is ? | the initial state value. for example, our counter,can started at 0. const [count, setCount] = useState(0); |
what 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. |
how to import use State API | import React, { useState } from 'react'; |
Como 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 <div>{/_ use all those things here _/}</div>; } |
This 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 |
Want to create your own Flashcards for free with GoConqr? Learn more.