Skip to content

Commit 441fd7e

Browse files
committed
cleanup rest of sandpacks
1 parent 3f51438 commit 441fd7e

File tree

5 files changed

+0
-345
lines changed

5 files changed

+0
-345
lines changed

src/content/learn/escape-hatches.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -452,23 +452,6 @@ This is not ideal. You want to re-connect to the chat only if the `roomId` has c
452452

453453
<Sandpack>
454454

455-
```json package.json hidden
456-
{
457-
"dependencies": {
458-
"react": "canary",
459-
"react-dom": "canary",
460-
"react-scripts": "latest",
461-
"toastify-js": "1.12.0"
462-
},
463-
"scripts": {
464-
"start": "react-scripts start",
465-
"build": "react-scripts build",
466-
"test": "react-scripts test --env=jsdom",
467-
"eject": "react-scripts eject"
468-
}
469-
}
470-
```
471-
472455
```js
473456
import { useState, useEffect } from 'react';
474457
import { useEffectEvent } from 'react';

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

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,22 +1253,6 @@ Is there a line of code inside the Effect that should not be reactive? How can y
12531253
12541254
<Sandpack>
12551255
1256-
```json package.json hidden
1257-
{
1258-
"dependencies": {
1259-
"react": "canary",
1260-
"react-dom": "canary",
1261-
"react-scripts": "latest"
1262-
},
1263-
"scripts": {
1264-
"start": "react-scripts start",
1265-
"build": "react-scripts build",
1266-
"test": "react-scripts test --env=jsdom",
1267-
"eject": "react-scripts eject"
1268-
}
1269-
}
1270-
```
1271-
12721256
```js
12731257
import { useState, useEffect, useRef } from 'react';
12741258
import { useEffectEvent } from 'react';
@@ -1380,22 +1364,6 @@ Your Effect needs to read the latest value of `duration`, but you don't want it
13801364
13811365
<Sandpack>
13821366
1383-
```json package.json hidden
1384-
{
1385-
"dependencies": {
1386-
"react": "canary",
1387-
"react-dom": "canary",
1388-
"react-scripts": "latest"
1389-
},
1390-
"scripts": {
1391-
"start": "react-scripts start",
1392-
"build": "react-scripts build",
1393-
"test": "react-scripts test --env=jsdom",
1394-
"eject": "react-scripts eject"
1395-
}
1396-
}
1397-
```
1398-
13991367
```js
14001368
import { useState, useEffect, useRef } from 'react';
14011369
import { FadeInAnimation } from './animation.js';
@@ -1816,23 +1784,6 @@ Another of these functions only exists to pass some state to an imported API met
18161784
18171785
<Sandpack>
18181786
1819-
```json package.json hidden
1820-
{
1821-
"dependencies": {
1822-
"react": "canary",
1823-
"react-dom": "canary",
1824-
"react-scripts": "latest",
1825-
"toastify-js": "1.12.0"
1826-
},
1827-
"scripts": {
1828-
"start": "react-scripts start",
1829-
"build": "react-scripts build",
1830-
"test": "react-scripts test --env=jsdom",
1831-
"eject": "react-scripts eject"
1832-
}
1833-
}
1834-
```
1835-
18361787
```js src/App.js
18371788
import { useState } from 'react';
18381789
import ChatRoom from './ChatRoom.js';
@@ -2111,23 +2062,6 @@ As a result, the chat re-connects only when something meaningful (`roomId` or `i
21112062
21122063
<Sandpack>
21132064
2114-
```json package.json hidden
2115-
{
2116-
"dependencies": {
2117-
"react": "canary",
2118-
"react-dom": "canary",
2119-
"react-scripts": "latest",
2120-
"toastify-js": "1.12.0"
2121-
},
2122-
"scripts": {
2123-
"start": "react-scripts start",
2124-
"build": "react-scripts build",
2125-
"test": "react-scripts test --env=jsdom",
2126-
"eject": "react-scripts eject"
2127-
}
2128-
}
2129-
```
2130-
21312065
```js src/App.js
21322066
import { useState } from 'react';
21332067
import ChatRoom from './ChatRoom.js';

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

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,23 +1061,6 @@ export function showNotification(message, theme = 'dark') {
10611061
}
10621062
```
10631063
1064-
```json package.json hidden
1065-
{
1066-
"dependencies": {
1067-
"react": "canary",
1068-
"react-dom": "canary",
1069-
"react-scripts": "latest",
1070-
"toastify-js": "1.12.0"
1071-
},
1072-
"scripts": {
1073-
"start": "react-scripts start",
1074-
"build": "react-scripts build",
1075-
"test": "react-scripts test --env=jsdom",
1076-
"eject": "react-scripts eject"
1077-
}
1078-
}
1079-
```
1080-
10811064
```css
10821065
input { display: block; margin-bottom: 20px; }
10831066
button { margin-left: 10px; }
@@ -1710,22 +1693,6 @@ html, body { min-height: 300px; }
17101693
}
17111694
```
17121695
1713-
```json package.json hidden
1714-
{
1715-
"dependencies": {
1716-
"react": "canary",
1717-
"react-dom": "canary",
1718-
"react-scripts": "latest"
1719-
},
1720-
"scripts": {
1721-
"start": "react-scripts start",
1722-
"build": "react-scripts build",
1723-
"test": "react-scripts test --env=jsdom",
1724-
"eject": "react-scripts eject"
1725-
}
1726-
}
1727-
```
1728-
17291696
</Sandpack>
17301697
17311698
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)
@@ -2199,22 +2166,6 @@ It looks like your `useInterval` Hook accepts an event listener as an argument.
21992166
22002167
<Sandpack>
22012168
2202-
```json package.json hidden
2203-
{
2204-
"dependencies": {
2205-
"react": "canary",
2206-
"react-dom": "canary",
2207-
"react-scripts": "latest"
2208-
},
2209-
"scripts": {
2210-
"start": "react-scripts start",
2211-
"build": "react-scripts build",
2212-
"test": "react-scripts test --env=jsdom",
2213-
"eject": "react-scripts eject"
2214-
}
2215-
}
2216-
```
2217-
22182169
```js
22192170
import { useCounter } from './useCounter.js';
22202171
import { useInterval } from './useInterval.js';
@@ -2270,22 +2221,6 @@ With this change, both intervals work as expected and don't interfere with each
22702221
22712222
<Sandpack>
22722223
2273-
```json package.json hidden
2274-
{
2275-
"dependencies": {
2276-
"react": "canary",
2277-
"react-dom": "canary",
2278-
"react-scripts": "latest"
2279-
},
2280-
"scripts": {
2281-
"start": "react-scripts start",
2282-
"build": "react-scripts build",
2283-
"test": "react-scripts test --env=jsdom",
2284-
"eject": "react-scripts eject"
2285-
}
2286-
}
2287-
```
2288-
22892224
22902225
```js
22912226
import { useCounter } from './useCounter.js';

0 commit comments

Comments
 (0)