Skip to content

Only re-render when you need to (Potentially huge perf boost) #1176

@JAStanton

Description

@JAStanton

What would you guys say to adding something like this:

shouldComponentUpdate(nextProps, nextState) {
  return !_.isEqual(this.props, nextProps) || !_.isEqual(this.state, nextState);
}

which would block calling render if the props or state haven't changed. If added to components that have simple props (i.e. don't take React elements) and have simple state but have heavy render methods (like TextField)?

I see this as a potentially huge perf boost when you have a giant form with lots of TextField and you're using valueLink. That is, every keystroke of one text field causes all sibling text field's to change to do the state changing.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions