Commit cbd26501 authored by Florent Chehab's avatar Florent Chehab
Browse files

Better performance by not updating none visible elements (Visibility is stored in props)

parent 0a024877
...@@ -119,6 +119,14 @@ class MyComponent extends Component { ...@@ -119,6 +119,14 @@ class MyComponent extends Component {
} }
myComponentDidMount() { }; myComponentDidMount() { };
shouldComponentUpdate(nextProps, nextState) {
if (typeof this.nextProps.visible != 'undefined' && !this.nextProps.visible) {
// don't rerender components that are not visible.
return false;
}
return true;
}
componentDidUpdate(prevProps, prevState, snapshot) { componentDidUpdate(prevProps, prevState, snapshot) {
// TODO ajouter expire date // TODO ajouter expire date
this.loadPropsIfNeeded(); this.loadPropsIfNeeded();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment