admin管理员组文章数量:1422077
index.js:1 Warning: State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the ponent body with useEffect().
const logon = async (email, password) => {
setValores({
email: email,
password: password
}, () => {
document.getElementById('loginSubmit').click();
});
};
index.js:1 Warning: State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the ponent body with useEffect().
const logon = async (email, password) => {
setValores({
email: email,
password: password
}, () => {
document.getElementById('loginSubmit').click();
});
};
Share
Improve this question
edited Jun 15, 2021 at 14:12
Dane Brouwer
2,9621 gold badge24 silver badges31 bronze badges
asked Apr 23, 2020 at 10:18
LeudyLeudy
171 silver badge1 bronze badge
1
- Can you edit your code and describe the problem and what you are trying to do! This topic may help you :) stackoverflow./help/how-to-ask – Dhia Djobbi Commented Apr 23, 2020 at 10:22
1 Answer
Reset to default 5Wele to Stack Overflow!
Please, when you post a question, make it an actual question. Post the code you tried to run, with some information on what the expected oute is. Read more about it here.
As for your problem, useState doesn't accept a callback as a parameter. If you want to perform an action after valores
has changed, you can use useEffect in the ponent's body:
useEffect(() => {
if (valores) {
document.getElementById('loginSubmit').click();
}
}, [valores])
本文标签:
版权声明:本文标题:javascript - index.js:1 Warning: State updates from the useState() and useReducer() Hooks don't support the second callb 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745357562a2655144.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论