React Study Guide
React Study Guide
Use the same techniques for deciding if you should create a new function or object. One
such technique is the single responsibility principle, that is, a component should ideally only
do one thing. Scan the components from the top of the hierarchy and if you find on the way
down, that a component repeats itself, or if it ends up growing, it should be decomposed into
smaller subcomponents. Si el contenido se debe generar dinámicamente, entonces vale
la pena convertirlo en un componente propio que takes in props?
Now that you’ve identified the components in the mockup, arrange them into a hierarchy.
Components that appear within another component in the mockup should appear as a child
in the hierarchy:
● FilterableProductTable
○ SearchBar
○ ProductTable
■ ProductCategoryRow
■ ProductRow
Which of these are state? Identify the ones that are not:
Tip: User interaction with the app is something we want to keep track of as it changes
over time and can't compute it from anywhere else so this will almost always be state.
To change the state according to user input if that state has been passed as props, you will
need to support data flowing the other way. We need to pass the setState functions to the
components that change state, into their event handlers.
Below are some of the most frequently used properties on the "mutation result" object. Refer
to useMutation for an extensive list of all returned properties.
data - The data returned from the latest trigger response, if present. If subsequent triggers
from the same hook instance are called, this will return undefined until the new data is
received. Consider component level caching if the previous response data is required for a
smooth transition to new data.
error - The error result if present.
isUninitialized - When true, indicates that the mutation has not been fired yet.
isLoading - When true, indicates that the mutation has been fired and is awaiting a response.
isSuccess - When true, indicates that the last mutation fired has data from a successful
request.
isError - When true, indicates that the last mutation fired resulted in an error state.
reset - A method to reset the hook back to it's original state and remove the current result
from the cache
Open Bootcamp
https://campus.open-bootcamp.com/cursos/1/leccion/192
La cuestión de dónde almacenar la lógica en los contenedores.
El uso de clases para crear instancias de objetos. Esto en caso de no recibir data de una
API.