Skip to content

Improve rendering time using shouldComponentUpdate and PureComponent #389

@gpbl

Description

@gpbl

Analyzing #374 I've found we can optimize the re-rending of the components by using shouldComponentUpdate or PureComponent.

  • Caption component – should be using shouldComponentUpdate to avoid useless re-rendering. Should update only if locale and date's year/month change.
  • NavBar component – can extend PureComponent
  • Weekday component – can extend PureComponent
  • Weekdays component – can extend PureComponent
  • Day component – should be using shouldComponentUpdate to avoid useless re-rendering. Should update only if the day's modifiers change.

The Month component uses its child as function to render Day, this is a weird pattern and makes optimization harder:

  • move renderDayInMonth and renderDay method from DayPicker to Month
  • Month component should be using shouldComponentUpdate to avoid useless re-rendering. Should update if modifiers change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions