Skip to content

Instantly share code, notes, and snippets.

@dounan
Last active October 31, 2017 02:37
Show Gist options
  • Save dounan/bda728ab047377e5b819ad717da64444 to your computer and use it in GitHub Desktop.
Save dounan/bda728ab047377e5b819ad717da64444 to your computer and use it in GitHub Desktop.
Example of transforming a bind call with reflective-bind
// ======================================================
// 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