nico
Published in : 2022-04-16
Hello, all i noticed that my component was rendered three times when I update an input in my form.
It is not good and feel like a performance problem.
So my question is : when a component is rendered, how can we know what state was updated when the function component is rendered?
That way I will try to optimize the code so the function component is rendered only once when I update the input of the form.
Thanks for your help
nico Date : 2022-04-16
Best answers
4
Best answers
4
Ironic, I use Formik in my case !
const formik = useFormik({
initialValues: {
xxx
},
validate,
onSubmit: (values) => {
cancelForm.current = false;
onPostData("/xxxx/Add", values);
formik.handleReset();
},
});
export function yyy({
xxx
}) {
…
…
console.log(
"%c xxx called",
"background: blue; color: #FFF"
);
I see the call %c xxx called" 3 times each time I update one input…
so it seems overkill
nico Date : 2022-04-16
Best answers
4
Best answers
4
it seems in devtool there is one option:
but do you know how to use it?
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now