reapp / reapp-ui

Amazing cross platform UI's with React and JavaScript
https://reapp.io
MIT License
257 stars 47 forks source link

Optimize ComponentProps #18

Closed natew closed 9 years ago

natew commented 9 years ago

Notice ...this.componentProps() used all over the place?

This is a helper function we made to add ref, styles, className, id, ref AND animation styles on all our nodes. It's awesome, but it's called all the time when animations are running.

And so, this is a great place to look. I think there is some big caching optimizations available here. I started looking at them, but backed out because it's not entirely simple. You'll probably introduce some state. Something like

componentWillMount() {
  this._cachedProps = {};
}

And from there figure out how to cache them without breaking stuff. But this would definitely improve animation performance big time.