Created
April 19, 2017 16:12
-
-
Save pavel-lens/5658cb8e65d9c06bcec12695d0279169 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createHandleChange(callback) { | |
// This has to be a ES5 function, because we need to access its `arguments` | |
return (function() { | |
// don't run for children that has no onChange prop | |
if (!callback) { | |
return | |
} | |
// set touched to true so we can re-render active Apply/Revert buttons | |
if (!this.state.touched) { | |
this.setState({ touched: true }) | |
} | |
// Call the original callback | |
callback.apply(null, arguments) | |
}).bind(this) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment