Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content/reference/react-dom/createPortal.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ Here is a complete example you can play with:
}
```

```js
```js src/App.js
import { useRef, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import { createMapWidget, addPopupToMapWidget } from './map-widget.js';
Expand Down
8 changes: 4 additions & 4 deletions src/content/reference/react/useLayoutEffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ To do this, you need to render in two passes:
**All of this needs to happen before the browser repaints the screen.** You don't want the user to see the tooltip moving. Call `useLayoutEffect` to perform the layout measurements before the browser repaints the screen:
```js
```js {5-8}
function Tooltip() {
const ref = useRef(null);
const [tooltipHeight, setTooltipHeight] = useState(0); // You don't know real height yet
Expand Down Expand Up @@ -187,7 +187,7 @@ export default function ButtonWithTooltip({ tooltipContent, ...rest }) {
}
```
```js
```js src/Tooltip.js active
import { useRef, useLayoutEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import TooltipContainer from './TooltipContainer.js';
Expand Down Expand Up @@ -337,7 +337,7 @@ export default function ButtonWithTooltip({ tooltipContent, ...rest }) {
}
```
```js
```js src/Tooltip.js active
import { useRef, useLayoutEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import TooltipContainer from './TooltipContainer.js';
Expand Down Expand Up @@ -484,7 +484,7 @@ export default function ButtonWithTooltip({ tooltipContent, ...rest }) {
}
```
```js
```js src/Tooltip.js active
import { useRef, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import TooltipContainer from './TooltipContainer.js';
Expand Down
2 changes: 1 addition & 1 deletion src/content/reference/react/useMemo.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default function App() {

```

```js
```js src/TodoList.js active
import { useMemo } from 'react';
import { filterTodos } from './utils.js'

Expand Down