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])