You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -115,33 +137,153 @@ Add the script tag to your `index.html`:
115
137
116
138
</details>
117
139
118
-
If you want to install the Chrome extension, follow the guide [here](https://github.com/aidenybai/react-scan/blob/main/CHROME_EXTENSION_GUIDE.md), or React Native support, see [here](https://github.com/aidenybai/react-scan/pull/23).
140
+
<details>
141
+
<summary><b>Remix</b></summary>
119
142
120
-
## API Reference
143
+
Add the script tag to your `app/root`:
121
144
122
-
If you need a programmatic API to debug further, install via NPM instead:
If you want to install the Chrome extension, follow the guide [here](https://github.com/aidenybai/react-scan/blob/main/CHROME_EXTENSION_GUIDE.md), or React Native support, see [here](https://github.com/aidenybai/react-scan/pull/23).
283
+
284
+
### CLI
143
285
144
-
If you don't have a localv version of the site, you can use the CLI. This will spin up an isolated browser instance which you can interact or use React Scan with.
286
+
If you don't have a local version of the site or you want to test a React app remotely, you can use the CLI. This will spin up an isolated browser instance which you can interact or use React Scan with.
145
287
146
288
```bash
147
289
npx react-scan@latest http://localhost:3000
@@ -160,6 +302,36 @@ You can add it to your existing dev process as well. Here's an example for Next.
160
302
}
161
303
```
162
304
305
+
### API
306
+
307
+
### Chrome Extension
308
+
309
+
### React Native
310
+
311
+
## API Reference
312
+
313
+
If you need a programmatic API to debug further, install via NPM instead:
314
+
315
+
```bash
316
+
npm install react-scan
317
+
```
318
+
319
+
Then, in your app, import this **BEFORE**`react`. This must run in a client context (e.g. not in a server component):
320
+
321
+
```js
322
+
import { scan } from"react-scan"; // import this BEFORE react
323
+
importReactfrom"react";
324
+
325
+
if (typeofwindow!=="undefined") {
326
+
scan({
327
+
enabled:true,
328
+
log:true, // logs render info to console (default: false)
329
+
});
330
+
}
331
+
```
332
+
333
+
> Looking for [React Native](https://github.com/aidenybai/react-scan/pull/23)?
334
+
163
335
## API Reference
164
336
165
337
<details>
@@ -248,9 +420,9 @@ export interface Options {
248
420
*
249
421
* @default"fast"
250
422
*/
251
-
animationSpeed?:'slow'|'fast'|'off';
423
+
animationSpeed?:"slow"|"fast"|"off";
252
424
253
-
/**
425
+
/**
254
426
* Smoothly animate the re-render outline when the element moves
255
427
*
256
428
* @defaulttrue
@@ -297,7 +469,7 @@ However, this makes it easy to accidentally cause unnecessary renders, making th
297
469
This often comes down to props that update in reference, like callbacks or object values. For example, the `onClick` function and `style` object are re-created on every render, causing `ExpensiveComponent` to slow down the app:
React Scan helps you identify these issues by automatically detecting and highlighting renders that cause performance issues. Now, instead of guessing, you can see exactly which components you need to fix.
0 commit comments