Skip to content

Commit be331d9

Browse files
Merge pull request #524 from reactjs/fix/conflicts
fix: resolved conflicts
2 parents ad83566 + b71a3ed commit be331d9

File tree

2 files changed

+0
-117
lines changed

2 files changed

+0
-117
lines changed

src/content/learn/removing-effect-dependencies.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -609,17 +609,6 @@ function ChatRoom({ roomId }) {
609609
610610
### Do you want to read a value without "reacting" to its changes? {/*do-you-want-to-read-a-value-without-reacting-to-its-changes*/}
611611
612-
<<<<<<< HEAD
613-
<Canary>
614-
615-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
616-
617-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
618-
619-
</Canary>
620-
621-
=======
622-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
623612
Suppose that you want to play a sound when the user receives a new message unless `isMuted` is `true`:
624613
625614
```js {3,10-12}
@@ -1264,25 +1253,6 @@ Is there a line of code inside the Effect that should not be reactive? How can y
12641253
12651254
<Sandpack>
12661255
1267-
<<<<<<< HEAD
1268-
```json package.json hidden
1269-
{
1270-
"dependencies": {
1271-
"react": "canary",
1272-
"react-dom": "canary",
1273-
"react-scripts": "latest"
1274-
},
1275-
"scripts": {
1276-
"start": "react-scripts start",
1277-
"build": "react-scripts build",
1278-
"test": "react-scripts test --env=jsdom",
1279-
"eject": "react-scripts eject"
1280-
}
1281-
}
1282-
```
1283-
1284-
=======
1285-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
12861256
```js
12871257
import { useState, useEffect, useRef } from 'react';
12881258
import { useEffectEvent } from 'react';
@@ -1394,25 +1364,6 @@ Your Effect needs to read the latest value of `duration`, but you don't want it
13941364
13951365
<Sandpack>
13961366
1397-
<<<<<<< HEAD
1398-
```json package.json hidden
1399-
{
1400-
"dependencies": {
1401-
"react": "canary",
1402-
"react-dom": "canary",
1403-
"react-scripts": "latest"
1404-
},
1405-
"scripts": {
1406-
"start": "react-scripts start",
1407-
"build": "react-scripts build",
1408-
"test": "react-scripts test --env=jsdom",
1409-
"eject": "react-scripts eject"
1410-
}
1411-
}
1412-
```
1413-
1414-
=======
1415-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
14161367
```js
14171368
import { useState, useEffect, useRef } from 'react';
14181369
import { FadeInAnimation } from './animation.js';

src/content/learn/reusing-logic-with-custom-hooks.md

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -837,17 +837,6 @@ Every time your `ChatRoom` component re-renders, it passes the latest `roomId` a
837837
838838
### Passing event handlers to custom Hooks {/*passing-event-handlers-to-custom-hooks*/}
839839
840-
<<<<<<< HEAD
841-
<Canary>
842-
843-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
844-
845-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
846-
847-
</Canary>
848-
849-
=======
850-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
851840
As you start using `useChatRoom` in more components, you might want to let components customize its behavior. For example, currently, the logic for what to do when a message arrives is hardcoded inside the Hook:
852841
853842
```js {9-11}
@@ -1721,25 +1710,6 @@ html, body { min-height: 300px; }
17211710
}
17221711
```
17231712
1724-
<<<<<<< HEAD
1725-
```json package.json hidden
1726-
{
1727-
"dependencies": {
1728-
"react": "canary",
1729-
"react-dom": "canary",
1730-
"react-scripts": "latest"
1731-
},
1732-
"scripts": {
1733-
"start": "react-scripts start",
1734-
"build": "react-scripts build",
1735-
"test": "react-scripts test --env=jsdom",
1736-
"eject": "react-scripts eject"
1737-
}
1738-
}
1739-
```
1740-
1741-
=======
1742-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
17431713
</Sandpack>
17441714
17451715
However, you didn't *have to* do that. As with regular functions, ultimately you decide where to draw the boundaries between different parts of your code. You could also take a very different approach. Instead of keeping the logic in the Effect, you could move most of the imperative logic inside a JavaScript [class:](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
@@ -2213,25 +2183,6 @@ It looks like your `useInterval` Hook accepts an event listener as an argument.
22132183
22142184
<Sandpack>
22152185
2216-
<<<<<<< HEAD
2217-
```json package.json hidden
2218-
{
2219-
"dependencies": {
2220-
"react": "canary",
2221-
"react-dom": "canary",
2222-
"react-scripts": "latest"
2223-
},
2224-
"scripts": {
2225-
"start": "react-scripts start",
2226-
"build": "react-scripts build",
2227-
"test": "react-scripts test --env=jsdom",
2228-
"eject": "react-scripts eject"
2229-
}
2230-
}
2231-
```
2232-
2233-
=======
2234-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
22352186
```js
22362187
import { useCounter } from './useCounter.js';
22372188
import { useInterval } from './useInterval.js';
@@ -2287,25 +2238,6 @@ With this change, both intervals work as expected and don't interfere with each
22872238
22882239
<Sandpack>
22892240
2290-
<<<<<<< HEAD
2291-
```json package.json hidden
2292-
{
2293-
"dependencies": {
2294-
"react": "canary",
2295-
"react-dom": "canary",
2296-
"react-scripts": "latest"
2297-
},
2298-
"scripts": {
2299-
"start": "react-scripts start",
2300-
"build": "react-scripts build",
2301-
"test": "react-scripts test --env=jsdom",
2302-
"eject": "react-scripts eject"
2303-
}
2304-
}
2305-
```
2306-
2307-
=======
2308-
>>>>>>> 11cb6b591571caf5fa2a192117b6a6445c3f2027
23092241
23102242
```js
23112243
import { useCounter } from './useCounter.js';

0 commit comments

Comments
 (0)