Skip to content

Commit 04d5582

Browse files
authored
Merge pull request #2794 from romanstetsyk/part1c-links
part1c. Update links to react docs
2 parents a0efd00 + 0287c5e commit 04d5582

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/content/1/en/part1c.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Making repeated calls to the _render_ method is not the recommended way to re-re
250250
251251
All of our components up till now have been simple in the sense that they have not contained any state that could change during the lifecycle of the component.
252252
253-
Next, let's add state to our application's <i>App</i> component with the help of React's [state hook](https://reactjs.org/docs/hooks-state.html).
253+
Next, let's add state to our application's <i>App</i> component with the help of React's [state hook](https://react.dev/learn/state-a-components-memory).
254254
255255
We will change the application as follows. <i>index.js</i> goes back to
256256
@@ -377,7 +377,7 @@ Let's change the application so that increasing the counter happens when a user
377377
378378
Button elements support so-called [mouse events](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent), of which [click](https://developer.mozilla.org/en-US/docs/Web/Events/click) is the most common event. The click event on a button can also be triggered with the keyboard or a touch screen despite the name <i>mouse event</i>.
379379
380-
In React, [registering an event handler function](https://reactjs.org/docs/handling-events.html) to the <i>click</i> event happens like this:
380+
In React, [registering an event handler function](https://react.dev/learn/responding-to-events) to the <i>click</i> event happens like this:
381381
382382
```js
383383
const App = () => {
@@ -542,7 +542,7 @@ It's recommended to write React components that are small and reusable across th
542542
543543
Let's first implement a <i>Display</i> component that's responsible for displaying the value of the counter.
544544
545-
One best practice in React is to [lift the state up](https://reactjs.org/docs/lifting-state-up.html) in the component hierarchy. The documentation says:
545+
One best practice in React is to [lift the state up](https://react.dev/learn/sharing-state-between-components) in the component hierarchy. The documentation says:
546546
547547
> <i>Often, several components need to reflect the same changing data. We recommend lifting the shared state up to their closest common ancestor.</i>
548548
@@ -629,13 +629,13 @@ const App = () => {
629629
630630
Since we now have an easily reusable <i>Button</i> component, we've also implemented new functionality into our application by adding a button that can be used to decrement the counter.
631631
632-
The event handler is passed to the <i>Button</i> component through the _handleClick_ prop. The name of the prop itself is not that significant, but our naming choice wasn't completely random. React's own official [tutorial](https://reactjs.org/tutorial/tutorial.html) suggests this convention.
632+
The event handler is passed to the <i>Button</i> component through the _handleClick_ prop. The name of the prop itself is not that significant, but our naming choice wasn't completely random. React's own official [tutorial](https://react.dev/learn/tutorial-tic-tac-toe) suggests this convention.
633633
634634
### Changes in state cause rerendering
635635
636636
Let's go over the main principles of how an application works once more.
637637
638-
When the application starts, the code in _App_ is executed. This code uses a [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook to create the application state, setting an initial value of the variable _counter_.
638+
When the application starts, the code in _App_ is executed. This code uses a [useState](https://react.dev/reference/react/useState) hook to create the application state, setting an initial value of the variable _counter_.
639639
This component contains the _Display_ component - which displays the counter's value, 0 - and three _Button_ components. The buttons all have event handlers, which are used to change the state of the counter.
640640
641641
When one of the buttons is clicked, the event handler is executed. The event handler changes the state of the _App_ component with the _setCounter_ function.

0 commit comments

Comments
 (0)