Skip to content

Commit fac0216

Browse files
docs: move next.js troubleshooting to the bottom
1 parent 45182c5 commit fac0216

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

docs/docs/troubleshooting.mdx

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -64,44 +64,6 @@ If you've imported the default styling and the tooltip is still not showing up w
6464

6565
If `data-tooltip-content` and `data-tooltip-html` are both unset (or they have empty values) on the anchor element, and also the `content`, `render`, and `children` props on the tooltip are unset (or have empty values), the tooltip is not shown by default.
6666

67-
## Next.js `TypeError: f is not a function`
68-
69-
This problem seems to be caused by a bug related to the SWC bundler used by Next.js.
70-
The best way to solve this is to upgrade to `next@13.3.0` or later versions.
71-
72-
Less ideally, if you're unable to upgrade, you can set `swcMinify: false` on your `next.config.js` file.
73-
74-
## Next.js `"use client"` error
75-
76-
This normally happens when you use `react-tooltip` inside a component that is not tagged as client component. For more info, see the [Next.js docs](https://nextjs.org/docs/getting-started/react-essentials#client-components).
77-
78-
To use `react-tooltip` on Next.js 13 without having to tag your component or page as a client component, just create a new file `ReactTooltip.tsx` (for this example, the file path is `src/components/ReactTooltip.tsx`) and place the following code inside of the created file:
79-
80-
:::caution
81-
82-
Avoid naming the file `react-tooltip.tsx` (or with whichever extension your project uses), since it may interfere with your editor's autocomplete funcionality.
83-
84-
:::
85-
86-
```jsx
87-
// src/components/ReactTooltip.tsx
88-
'use client'
89-
90-
export * from 'react-tooltip'
91-
```
92-
93-
And in the place that you are importing React Tooltip:
94-
95-
```jsx
96-
// ❌ Old
97-
import { Tooltip } from 'react-tooltip'
98-
```
99-
100-
```jsx
101-
// ✅ New
102-
import { Tooltip } from 'components/react-tooltip'
103-
```
104-
10567
## Bad performance
10668

10769
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.
@@ -156,3 +118,41 @@ Check the examples for the [`anchorSelect`](./examples/anchor-select) and [`rend
156118
</div>
157119
<Tooltip id="my-tooltip" />
158120
```
121+
122+
## Next.js `TypeError: f is not a function`
123+
124+
This problem seems to be caused by a bug related to the SWC bundler used by Next.js.
125+
The best way to solve this is to upgrade to `next@13.3.0` or later versions.
126+
127+
Less ideally, if you're unable to upgrade, you can set `swcMinify: false` on your `next.config.js` file.
128+
129+
## Next.js `"use client"` error
130+
131+
This normally happens when you use `react-tooltip` inside a component that is not tagged as client component. For more info, see the [Next.js docs](https://nextjs.org/docs/getting-started/react-essentials#client-components).
132+
133+
To use `react-tooltip` on Next.js 13 without having to tag your component or page as a client component, just create a new file `ReactTooltip.tsx` (for this example, the file path is `src/components/ReactTooltip.tsx`) and place the following code inside of the created file:
134+
135+
:::caution
136+
137+
Avoid naming the file `react-tooltip.tsx` (or with whichever extension your project uses), since it may interfere with your editor's autocomplete funcionality.
138+
139+
:::
140+
141+
```jsx
142+
// src/components/ReactTooltip.tsx
143+
'use client'
144+
145+
export * from 'react-tooltip'
146+
```
147+
148+
And in the place that you are importing React Tooltip:
149+
150+
```jsx
151+
// ❌ Old
152+
import { Tooltip } from 'react-tooltip'
153+
```
154+
155+
```jsx
156+
// ✅ New
157+
import { Tooltip } from 'components/react-tooltip'
158+
```

0 commit comments

Comments
 (0)