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
Copy file name to clipboardExpand all lines: README.md
+80Lines changed: 80 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,86 @@ import ReactDOMServer from 'react-dom/server';
153
153
</a>
154
154
```
155
155
156
+
## Troubleshooting
157
+
158
+
Before trying these, make sure you're running the latest ReactTooltip version with
159
+
160
+
```sh
161
+
npm install react-tooltip@latest
162
+
```
163
+
164
+
or
165
+
166
+
```sh
167
+
yarn add react-tooltip@latest
168
+
```
169
+
170
+
If you can't find your problem here, make sure there isn't [an open issue](https://github.com/ReactTooltip/react-tooltip/issues) already covering it.
171
+
If there isn't, feel free to [submit a new issue](https://github.com/ReactTooltip/react-tooltip/issues/new/choose).
172
+
173
+
### Next.js `TypeError: f is not a function`
174
+
175
+
This problem seems to be caused by a bug related to the SWC bundler used by Next.js.
176
+
The best way to solve this is to upgrade to `next@13.3.0` or later versions.
177
+
178
+
Less ideally, if you're unable to upgrade, you can set `swcMinify: false` on your `next.config.js` file.
179
+
180
+
### Bad performance
181
+
182
+
If you're experiencing any kind of unexpected behavior or bad performance on your application when using ReactTooltip, here are a few things you can try.
183
+
184
+
#### Move `<Tooltip />` on the DOM
185
+
186
+
This is specially relevant when using components that are conditionally rendered.
187
+
188
+
Always try to keep the `<Tooltip />` component rendered, so if you're having issues with a tooltip you've placed inside a component which is placed/removed from the DOM dynamically, try to move the tooltip outside of it.
189
+
190
+
We usually recommend placing the tooltip component directly inside the root component of your application (usually on `App.jsx`/`App.tsx`). You can also move the `import 'react-tooltip/dist/react-tooltip.css'` there.
191
+
192
+
#### Dynamically generated anchor elements
193
+
194
+
You should avoid needlessly using a large amount of `<Tooltip />` components. One tooltip component that you use across your whole application should be good enough in most cases, but you should be fine to add a few more if you need to use different styled tooltips.
195
+
196
+
Here's a simple example on how to improve performance when using dynamically generated items.
197
+
Check the docs for examples for the [`anchorSelect`](https://react-tooltip.com/docs/examples/anchor-select) and [`render`](https://react-tooltip.com/docs/examples/render) props for more complex use cases.
0 commit comments