Last active
October 31, 2017 02:37
-
-
Save dounan/bda728ab047377e5b819ad717da64444 to your computer and use it in GitHub Desktop.
Example of transforming a bind call with reflective-bind
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
// ====================================================== | |
// Original code | |
function MyComponent(props) { | |
return <PureChild onClick={alert.bind(null, "Hello world")} /> | |
} | |
// ====================================================== | |
// After reflective-bind/babel transforms the code | |
function MyComponent(props) { | |
return <PureChild onClick={reflectiveBind(alert, null, "Hello world")} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment