Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

Commit 5794ee8

Browse files
authored
Fix server warning for useLayoutEffect (#59)
* Fix server warning for useLayoutEffect * Fix package * Add comment explaining it * Update jest config
1 parent 1f11ba5 commit 5794ee8

File tree

5 files changed

+7774
-8843
lines changed

5 files changed

+7774
-8843
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
"version": "detect"
1818
}
1919
},
20+
"plugins": ["react-hooks"],
2021
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
2122
"rules": {
2223
"react/prop-types": "off",
23-
"no-unused-vars": ["error", { "ignoreRestSiblings": true }]
24+
"no-unused-vars": ["error", { "ignoreRestSiblings": true }],
25+
"react-hooks/rules-of-hooks": "error"
2426
}
2527
}

demo/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class App extends React.Component {
118118
state = {
119119
arrow: false,
120120
customClass: 'hello',
121+
content: 'hello',
121122
}
122123

123124
toggleArrow = () => {
@@ -128,8 +129,8 @@ class App extends React.Component {
128129

129130
componentDidMount() {
130131
setTimeout(() => {
131-
this.setState({ customClass: 'bye' })
132-
}, 500)
132+
this.setState({ customClass: 'bye', content: 'testing content update' })
133+
}, 2000)
133134
}
134135

135136
render() {
@@ -174,7 +175,11 @@ class App extends React.Component {
174175
</Tippy>
175176

176177
<h1>Other</h1>
177-
<Tippy trigger="click" className={this.state.customClass}>
178+
<Tippy
179+
content={this.state.content}
180+
trigger="click"
181+
className={this.state.customClass}
182+
>
178183
<button>Custom class</button>
179184
</Tippy>
180185
</main>

0 commit comments

Comments
 (0)