-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当前的usePrevious实现违反了useRef的使用准则的。 #780
Comments
React 官网文档上提供了另一种实现思路 但是我觉得我们现在的 |
请看这个示例: function Content() {
const [v, setV] = useState(0);
const p0 = usePrevious(v);
const p1 = usePrevious(p0);
const p2 = usePrevious(p1);
return (
<>
<div>
<button onClick={() => setV(v + 1)}>+1</button>
</div>
<div>
{p0},{p1},{p2}
</div>
</>
);
} |
@heroboy 嗯嗯的确复现出来了…… 而且我试了一下,如果用 React 官方文档上的 |
Hello: 这个问题我们已经在 v3.0 版本彻底修复,目前 v3.0 版本已经发布 alpha 版本。 欢迎试用。 文档:https://ahooks-next.surge.sh/ 安装最新分支
We have fixed this problem in the v3.0 version, and the alpha has been released. Welcome to try. Doc:https://ahooks-next.surge.sh/ Install v3.0
|
在render中不能读写current。除了,这种模式:
facebook/react#18545
The text was updated successfully, but these errors were encountered: