Skip to content

Commit aa1d121

Browse files
authored
Merge pull request #3551 from pablo-maff/part7-spanish
Part7 spanish
2 parents 3a96af8 + 780255d commit aa1d121

File tree

24 files changed

+607
-679
lines changed

24 files changed

+607
-679
lines changed

src/content/0/es/part0b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ La cosa denominada AJAX es ahora tan común que se da por sentado. El término s
494494
495495
En nuestra aplicación de ejemplo, la página de inicio funciona como una página web tradicional: toda la lógica está en el servidor y el navegador solo muestra el HTML como se indica.
496496
497-
La página Notas da parte de la responsabilidad al navegador, la generación del código HTML para las notas existentes. El navegador aborda esta tarea ejecutando el código JavaScript que obtuvo del servidor. El código obtiene las notas del servidor como datos JSON y agrega elementos HTML para mostrar las notas en la página usando la [DOM-API](/es/part0/fundamentos_de_las_aplicaciones_web#modelo-de-objeto-de-documento-o-dom).
497+
La página Notas da parte de la responsabilidad al navegador, la generación del código HTML para las notas existentes. El navegador aborda esta tarea ejecutando el código JavaScript que obtuvo del servidor. El código obtiene las notas del servidor como datos JSON y agrega elementos HTML para mostrar las notas en la página usando la [DOM-API](/es/part0/fundamentos_de_las_aplicaciones_web#modelo-de-objetos-del-documento-o-dom).
498498
499499
En los últimos años, ha surgido el estilo de [Aplicación de una sola página](https://es.wikipedia.org/wiki/Single-page_application) (SPA) para crear aplicaciones web. Los sitios web de estilo SPA no obtienen todas sus páginas por separado del servidor como lo hace nuestra aplicación de muestra, sino que comprenden solo una página HTML obtenida del servidor, cuyo contenido se manipula con JavaScript que se ejecuta en el navegador.
500500

src/content/1/en/part1d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ The first <i>State</i> contains the value of the <i>left</i> state, the next con
561561

562562
### Rules of Hooks
563563

564-
There are a few limitations and rules we have to follow to ensure that our application uses hooks-based state functions correctly.
564+
There are a few limitations and [rules](https://react.dev/warnings/invalid-hook-call-warning#breaking-rules-of-hooks) that we have to follow to ensure that our application uses hooks-based state functions correctly.
565565

566566
The _useState_ function (as well as the _useEffect_ function introduced later on in the course) <i>must not be called</i> from inside of a loop, a conditional expression, or any place that is not a function defining a component. This must be done to ensure that the hooks are always called in the same order, and if this isn't the case the application will behave erratically.
567567

src/content/1/es/part1d.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,9 @@ El primer <i>State</i> contiene el valor del estado <i>left</i>, el siguiente co
561561

562562
### Reglas de los Hooks
563563

564-
Hay algunas limitaciones y reglas que debemos seguir para asegurarnos de que nuestra aplicación utilice correctamente las funciones de estado basadas en hooks.
564+
Hay algunas limitaciones y [reglas](https://es.react.dev/warnings/invalid-hook-call-warning#breaking-rules-of-hooks) que debemos seguir para asegurarnos de que nuestra aplicación utilice correctamente las funciones de estado basadas en hooks.
565565

566-
La función _useState_ (así como la función _useEffect_ presentada más adelante en el curso) <i>no se debe llamar</i> desde dentro de un ciclo, una expresión condicional o cualquier lugar que no sea una función que defina un componente. Esto debe hacerse para garantizar que los hooks siempre se llamen en el mismo orden o, si este no es el caso, la aplicación se comportará de manera errática.
566+
La función _useState_ (así como la función _useEffect_ presentada más adelante en el curso) <i>no se debe llamar</i> desde dentro de un loop, una expresión condicional o cualquier lugar que no sea una función que defina a un componente. Esto debe hacerse para garantizar que los hooks siempre se llamen en el mismo orden o, si este no es el caso, la aplicación se comportará de manera errática.
567567

568568
En resumen, los hooks solo se pueden llamar desde el interior de un cuerpo de la función que define un componente de React:
569569

src/content/6/en/part6d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ The solution is quite elegant. The entire state of the application, i.e. the val
769769

770770
The final code for the application is in [GitHub](https://github.com/fullstack-hy2020/hook-counter/tree/part6-3) in the branch <i>part6-3</i>.
771771

772-
As a technical detail, it should be noted that the helper functions <i>useCounterValue</i> and <i>useCounterDispatch</i> are defined as [custom hooks](https://react.dev/learn/reusing-logic-with-custom-hooks), because calling the hook function <i>useContext</i> is [possible](https://legacy.reactjs.org/docs/hooks-rules.html) only from React components or custom hooks. Custom hooks are JavaScript functions whose name must start with the word _use_. We will return to custom hooks in a little more detail in [part 7](/en/part7/custom_hooks) of the course.
772+
As a technical detail, it should be noted that the helper functions <i>useCounterValue</i> and <i>useCounterDispatch</i> are defined as [custom hooks](https://react.dev/learn/reusing-logic-with-custom-hooks), because calling the hook function <i>useContext</i> is [possible](https://react.dev/warnings/invalid-hook-call-warning#breaking-rules-of-hooks) only from React components or custom hooks. Custom hooks are JavaScript functions whose name must start with the word _use_. We will return to custom hooks in a little more detail in [part 7](/en/part7/custom_hooks) of the course.
773773

774774
</div>
775775

src/content/6/es/part6d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ La solución es bastante elegante. Todo el estado de la aplicación, es decir, e
769769

770770
El código de la aplicación final se encuentra en [GitHub](https://github.com/fullstack-hy2020/hook-counter/tree/part6-3) en la rama <i>part6-3</i>.
771771

772-
Como detalle técnico, debe tenerse en cuenta que las funciones auxiliares <i>useCounterValue</i> y <i>useCounterDispatch</i> se definen como [hooks personalizados](https://es.react.dev/learn/reusing-logic-with-custom-hooks), porque llamar a la función de hook <i>useContext</i> es [posible]([https://es.reactjs.org/docs/hooks -reglas.html](https://es.legacy.reactjs.org/docs/hooks-rules.html)) solo desde componentes de React o hooks personalizados. Los hooks personalizados, por otro lado, son funciones JavaScript cuyo nombre debe comenzar con la palabra _use_. Volveremos a los hooks personalizados en un poco más de detalle en la [parte 7](/es/part7/hooks_personalizados) del curso.
772+
Como detalle técnico, debe tenerse en cuenta que las funciones auxiliares <i>useCounterValue</i> y <i>useCounterDispatch</i> se definen como [hooks personalizados](https://es.react.dev/learn/reusing-logic-with-custom-hooks), porque llamar a la función de hook <i>useContext</i> es [posible](https://es.react.dev/warnings/invalid-hook-call-warning#breaking-rules-of-hooks) solo desde componentes de React o hooks personalizados. Los hooks personalizados, por otro lado, son funciones JavaScript cuyo nombre debe comenzar con la palabra _use_. Volveremos a los hooks personalizados en un poco más de detalle en la [parte 7](/es/part7/hooks_personalizados) del curso.
773773

774774
</div>
775775

src/content/6/zh/part6a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ lang: zh
1212

1313
### Flux-architecture
1414

15-
<!-- Facebook developed the [Flux](https://facebook.github.io/flux/docs/in-depth-overview/)- architecture to make state management easier. In Flux, the state is separated completely from the React-components into its own <i>stores</i>.-->
16-
Facebook开发了[Flux](https://facebook.github.io/flux/docs/in-depth-overview/)-架构,使状态管理更容易。在Flux中,状态被完全从React组件中分离出来,进入它自己的<i>存储</i>。
15+
<!-- Facebook developed the [Flux](https://facebookarchive.github.io/flux/docs/in-depth-overview//)- architecture to make state management easier. In Flux, the state is separated completely from the React-components into its own <i>stores</i>.-->
16+
Facebook开发了[Flux](https://facebookarchive.github.io/flux/docs/in-depth-overview//)-架构,使状态管理更容易。在Flux中,状态被完全从React组件中分离出来,进入它自己的<i>存储</i>。
1717
<!-- State in the store is not changed directly, but with different <i>actions</i>.-->
1818
存储器中的状态不是直接改变的,而是通过不同的<i>动作</i>改变的。
1919

src/content/7/en/part7.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ lang: en
66

77
<div class="intro">
88

9-
The seventh part of the course touches on several different themes. First, we'll get familiar with React router. React router helps us divide the application into different views that are shown based on the URL in the browser's address bar. After this, we'll look at a few more ways to add CSS styles to React applications. During the entire course, we've used Vite to generate the body of our applications.
9+
The seventh part of the course touches on several different themes. First, we'll get familiar with React Router. React Router helps us divide the application into different views that are shown based on the URL in the browser's address bar. After this, we'll look at a few more ways to add CSS styles to React applications. During the entire course, we've used Vite to build of our applications.
1010
It is also possible to configure the whole toolchain yourself, and in this part we will see how this can be done with a tool called Webpack. We shall also have a look at hook functions and how to define a custom hook.
1111

1212
<i>Part updated 26th August 2023</i>

src/content/7/en/part7a.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ lang: en
77

88
<div class="content">
99

10-
The exercises in this seventh part of the course differ a bit from the ones before. In this and the next chapter, as usual, there are [exercises related to the theory in the chapter](/en/part7/react_router#exercises-7-1-7-3).
10+
The exercises in this seventh part of the course differ a bit from the ones before. In this and the next chapter, as usual, there are [exercises related to the theory of the chapter](/en/part7/react_router#exercises-7-1-7-3).
1111

12-
In addition to the exercises in this and the next chapter, there are a series of exercises in which we'll be revising what we've learned during the whole course by expanding the Bloglist application which we worked on during parts 4 and 5.
12+
In addition to the exercises in this and the next chapter, there are a series of exercises in which we'll be revising what we've learned during the whole course, by expanding the BlogList application, in which we worked on during parts 4 and 5.
1313

1414
### Application navigation structure
1515

@@ -101,7 +101,7 @@ However, the method is not very optimal. As we can see from the pictures, the ad
101101

102102
Luckily, React has the [React Router](https://reactrouter.com/) library which provides an excellent solution for managing navigation in a React application.
103103

104-
Let's change the above application to use React Router. First, we install React Router with the command
104+
Let's change the above application to use React Router. First, we install React Router with the command:
105105

106106
```bash
107107
npm install react-router-dom
@@ -136,7 +136,7 @@ const App = () => {
136136
</Routes>
137137

138138
<div>
139-
<i>Note app, Department of Computer Science 2023</i>
139+
<i>Note app, Department of Computer Science 2024</i>
140140
</div>
141141
</Router>
142142
)
@@ -160,7 +160,7 @@ According to the [v5 docs](https://v5.reactrouter.com/web/api/BrowserRouter):
160160
161161
Normally the browser loads a new page when the URL in the address bar changes. However, with the help of the [HTML5 history API](https://css-tricks.com/using-the-html5-history-api/), <i>BrowserRouter</i> enables us to use the URL in the address bar of the browser for internal "routing" in a React application. So, even if the URL in the address bar changes, the content of the page is only manipulated using Javascript, and the browser will not load new content from the server. Using the back and forward actions, as well as making bookmarks, is still logical like on a traditional web page.
162162

163-
Inside the router, we define <i>links</i> that modify the address bar with the help of the [Link](https://reactrouter.com/en/main/components/link) component. For example,
163+
Inside the router, we define <i>links</i> that modify the address bar with the help of the [Link](https://reactrouter.com/en/main/components/link) component. For example:
164164

165165
```js
166166
<Link to="/notes">notes</Link>
@@ -215,7 +215,7 @@ const Notes = ({notes}) => (
215215
)
216216
```
217217

218-
We define parameterized URLs in the routing in <i>App</i> component as follows:
218+
We define parameterized URLs in the routing of the <i>App</i> component as follows:
219219

220220
```js
221221
<Router>
@@ -284,7 +284,7 @@ The option to navigate to the <i>Login</i> view is rendered conditionally in the
284284
</Router>
285285
```
286286

287-
So if the user is already logged in, instead of displaying the link <i>Login</i>, we show the username of the user:
287+
So if the user is already logged in, instead of displaying the link <i>Login</i>, we show its username:
288288

289289
![browser notes app showing username logged in](../../images/7/4a.png)
290290

@@ -326,9 +326,9 @@ What is interesting about this component is the use of the [useNavigate](https:/
326326

327327
With user login, we call _navigate('/')_ which causes the browser's URL to change to _/_ and the application renders the corresponding component <i>Home</i>.
328328

329-
Both [useParams](https://reactrouter.com/en/main/hooks/use-params) and [useNavigate](https://reactrouter.com/en/main/hooks/use-navigate) are hook functions, just like useState and useEffect which we have used many times now. As you remember from part 1, there are some [rules](/en/part1/a_more_complex_state_debugging_react_apps/#rules-of-hooks) to using hook functions. Create-react-app has been configured to warn you if you break these rules, for example, by calling a hook function from a conditional statement.
329+
Both [useParams](https://reactrouter.com/en/main/hooks/use-params) and [useNavigate](https://reactrouter.com/en/main/hooks/use-navigate) are hook functions, just like useState and useEffect which we have used many times now. As you remember from part 1, there are some [rules](/en/part1/a_more_complex_state_debugging_react_apps/#rules-of-hooks) to using hook functions.
330330

331-
### redirect
331+
### Redirect
332332

333333
There is one more interesting detail about the <i>Users</i> route:
334334

@@ -385,7 +385,7 @@ const App = () => {
385385
</Router>
386386
<footer>
387387
<br />
388-
<em>Note app, Department of Computer Science 2023</em>
388+
<em>Note app, Department of Computer Science 2024</em>
389389
</footer>
390390
</div>
391391
)
@@ -396,7 +396,7 @@ We define an element common for modern web apps called <i>footer</i>, which defi
396396

397397
### Parameterized route revisited
398398

399-
Our application has a flaw. The _Note_ component receives all of the notes, even though it only displays the one whose id matches the url parameter:
399+
Our application has a flaw. The _Note_ component receives all of the notes, even though it only displays the one whose id matches the URL parameter:
400400

401401
```js
402402
const Note = ({ notes }) => {
@@ -420,7 +420,7 @@ const Note = ({ note }) => {
420420
}
421421
```
422422

423-
One way to do this would be to use React Router's [useMatch](https://reactrouter.com/en/v6.3.0/api#usematch) hook to figure out the id of the note to be displayed in the _App_ component.
423+
One way to do this would be to use React Router's [useMatch](https://reactrouter.com/en/main/hooks/use-match) hook to figure out the id of the note to be displayed in the _App_ component.
424424

425425
It is not possible to use the <i>useMatch</i> hook in the component which defines the routed part of the application. Let's move the use of the _Router_ components from _App_:
426426

@@ -467,7 +467,7 @@ const App = () => {
467467
</Routes>
468468

469469
<div>
470-
<em>Note app, Department of Computer Science 2023</em>
470+
<em>Note app, Department of Computer Science 2024</em>
471471
</div>
472472
</div>
473473
)
@@ -491,6 +491,7 @@ const note = match
491491
The completed code can be found [here](https://github.com/fullstack-hy2020/misc/blob/master/router-app-v2.js).
492492

493493
</div>
494+
494495
<div class="tasks">
495496

496497
### Exercises 7.1.-7.3.
@@ -504,14 +505,14 @@ cd routed-anecdotes // go first to directory of the cloned repository
504505
rm -rf .git
505506
```
506507

507-
The application starts the usual way, but first, you need to install the dependencies of the application:
508+
The application starts the usual way, but first, you need to install its dependencies:
508509

509510
```bash
510511
npm install
511512
npm run dev
512513
```
513514

514-
#### 7.1: routed anecdotes, step1
515+
#### 7.1: Routed Anecdotes, step 1
515516

516517
Add React Router to the application so that by clicking links in the <i>Menu</i> component the view can be changed.
517518

@@ -525,7 +526,7 @@ The creation of a new anecdote should happen e.g. in the path <i>create</i>:
525526

526527
![browser anecdotes /create shows create form](../../assets/teht/41.png)
527528

528-
#### 7.2: routed anecdotes, step2
529+
#### 7.2: Routed Anecdotes, step 2
529530

530531
Implement a view for showing a single anecdote:
531532

@@ -535,7 +536,7 @@ Navigating to the page showing the single anecdote is done by clicking the name
535536

536537
![browser showing previous link that was clicked](../../assets/teht/43.png)
537538

538-
#### 7.3: routed anecdotes, step3
539+
#### 7.3: Routed Anecdotes, step3
539540

540541
The default functionality of the creation form is quite confusing because nothing seems to be happening after creating a new anecdote using the form.
541542

0 commit comments

Comments
 (0)