Skip to content

Commit c08da7f

Browse files
authored
docs: fix code example (#10355)
1 parent 0a96122 commit c08da7f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

guide/api-hmr.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ A self-accepting module may realize during runtime that it can't handle a HMR up
129129
130130
Note that you should always call `import.meta.hot.accept` even if you plan to call `invalidate` immediately afterwards, or else the HMR client won't listen for future changes to the self-accepting module. To communicate your intent clearly, we recommend calling `invalidate` within the `accept` callback like so:
131131
132-
```ts
133-
import.meta.hot.accept(module => {
134-
// You may use the new module instance to decide whether to invalidate.
135-
if (cannotHandleUpdate(module)) {
136-
import.meta.hot.invalidate()
137-
}
138-
})
139-
```
132+
```js
133+
import.meta.hot.accept((module) => {
134+
// You may use the new module instance to decide whether to invalidate.
135+
if (cannotHandleUpdate(module)) {
136+
import.meta.hot.invalidate()
137+
}
138+
})
139+
```
140140
141141
## `hot.on(event, cb)`
142142

0 commit comments

Comments
 (0)