Created
April 10, 2016 16:53
-
-
Save foleyatwork/64603b9e7f169914f919f93b21673ae2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// You can make stateless React components from pure functions | |
// but you lose out on the ability to do .bind(this, this.props) | |
// in event callbacks. Below is an empty component that shows | |
// a possible workaround for that limitation. | |
// This would be useful for components that have no state but | |
// update a store. | |
import React from 'react'; | |
const doSomethingWithProps = (props) { | |
return () => { | |
// You have access to props in here. | |
}; | |
}; | |
export default (props) => { | |
return ( | |
<div onClick={doSomethingWithProps(props)}></div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment