Skip to content

Commit

Permalink
Docs: Specify which react-devtools version is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed Jan 17, 2022
1 parent 429890d commit e981ccb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions docs/basics/debug-an-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ We automatically disable console logging for store extensions.

### Unhandled exceptions and promise rejections

All unhandled exceptions and promise rejections are shown with an error overlay in Raycast.
All unhandled exceptions and promise rejections are shown with an error overlay in Raycast.

![Unhandled exception in development mode](../.gitbook/assets/basics-unhandled-exception.png)

During development, we show the stack trace and add an action to jump to the error to make it easy to fix it. In production, only the error message is shown. You should [show a toast](../api-reference/user-interface/toast.md#showtoast) for all expected errors, e.g. a failing network request.

### React Developer Tools

We support [React Developer Tools](https://github.com/facebook/react/tree/main/packages/react-devtools) out-of-the-box. Use the tools to inspect and change the props of your React components, and see the results immediately in Raycast. This is especially useful for complex commands with a lot of state.
We support [React Developer Tools](https://github.com/facebook/react/tree/main/packages/react-devtools) out-of-the-box. Use the tools to inspect and change the props of your React components, and see the results immediately in Raycast. This is especially useful for complex commands with a lot of state.

![React Developer Tools](../.gitbook/assets/basics-react-developer-tools.png)

To get started, add the `react-devtools` to your extension. Open a terminal, navigate to your extension directory and run the following command:

```typescript
npm install --save-dev react-devtools
npm install --save-dev react-devtools@4.21.0
```

Then re-build your extension with `npm run dev`, open the command you want to debug in Raycast and launch the React Developer Tools with `` `` `D`. Now select one of the React components, change a prop in the right sidebar and hit enter. You'll notice the change immediately in Raycast.
Expand All @@ -55,7 +55,7 @@ You notice a few React components that are prefixed with `Internal` which we add
If you prefer to install the `react-devtools` globally, you can do the following:

```bash
npm install -g react-devtools
npm install -g react-devtools@4.21.0
```

Then you can run `react-devtools` from a terminal to launch the standalone DevTools app. Raycast connects automatically and you can start debugging your component tree.
Expand All @@ -67,8 +67,8 @@ By default, extensions installed from the store run in Node production mode and
At runtime, you can check which Node environment you're running in:

```typescript
if (process.env.NODE_ENV === "development") {
// running in development Node environment
if (process.env.NODE_ENV === "development") {
// running in development Node environment
}
```

Expand All @@ -81,4 +81,3 @@ if (environment.isDevelopment) {
// running the development version
}
```

0 comments on commit e981ccb

Please sign in to comment.