3

I have been using react's controlled components in my application and .

But I am noticing that as I enter more and more inputs to these form components my page is slowing down badly or even hangs sometime.

Any clue ?

1 Answer 1

1

Sounds like you should look into the key="" attribute. Most often when react starts to slow down it is related to it doing more work than necessary. Another way to improve performance is implementing shouldComponentUpdate, but that should first be necessary later on.

Sign up to request clarification or add additional context in comments.

4 Comments

Great answer. Thanks Emil.
I am having the same issue, but I am not sure if I too should add the key attribute? I am not looping over some data to print a list or something using a .map. I have a list of <Grid/> components that are statically rendered.
@maverick only dynamically rendered items should have a key. If key is missing and needed, then it should, in the later version of React, be written as warnings in the developer console.
Well, I'm noticing the same performance issues, as every onChange event changes state, and thus the components is re-rendered. That has a big impact on performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.