Skip to content

Commit 1791c1d

Browse files
committed
keep guide stuff to guides
1 parent e0745c9 commit 1791c1d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

beta/src/content/apis/react/useEffect.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ useEffect(setup, dependencies)
2020

2121
### Connecting to an external system {/*connecting-to-an-external-system*/}
2222

23-
There are two kinds of logic in your React components. Code that only calculates something is called *pure.* For example, transforming some data into JSX is a [pure calculation.](/learn/keeping-components-pure) The rest of your logic *does* something: for example, it may send a network request in response to a button click. That kind of logic is called a ["side effect".](https://en.wikipedia.org/wiki/Side_effect_(computer_science))
23+
Sometimes, your component might need to stay connected to the network, some browser API, or a third-party library, while it is displayed on the page. Such systems aren't controlled by React, so they are called *external.*
2424

25-
Most of your side effects will be inside [event handlers](/learn/responding-to-events) like `onClick`. However, when a component needs to run some code *in response to being displayed* rather than to any particular interaction, you need to [declare an Effect.](/learn/synchronizing-with-effects#how-to-write-an-effect) For example, your component might need to stay connected to the network, some browser API, or a third-party library, while it is displayed on the page. These systems aren't controlled by React, so they are called *external.*
26-
27-
To connect your component to some external system, call `useEffect` at the top level of your component:
25+
To [connect your component to some external system,](/learn/synchronizing-with-effects) call `useEffect` at the top level of your component:
2826

2927
```js [[1, 8, "const connection = createConnection(serverUrl, roomId);"], [1, 9, "connection.connect();"], [2, 11, "connection.disconnect();"], [3, 13, "[serverUrl, roomId]"]]
3028
import { useEffect } from 'react';

0 commit comments

Comments
 (0)