Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Conversation

cherniavskii
Copy link
Member

  • I have changed my target branch to develop 👊

Description

This PR aims to remove passing anonymous functions as props.
When passing anonymous arrow function as a prop - new function is created every time component is rendered, so if it's passed to PureComponent - shouldComponentUpdate will return true every time.
Also, often anonymous arrow functions use closure, which may cause performance issues.

Here's what changed:

  • added Year component with simple API, used by YearSelection
  • used ref for scrolling to selected year instead of document.getElementsByClassName
  • added Day and DayWrapper components with simple API, used by Calendar
  • removed anonymous functions whenever possible

@dmtrKovalenko dmtrKovalenko merged commit 8209072 into develop Jan 2, 2018
@cherniavskii cherniavskii deleted the avoid-anonymous-functions branch January 2, 2018 11:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants