Skip to content

Instantly share code, notes, and snippets.

@foleyatwork
Created April 10, 2016 16:53
Show Gist options
  • Save foleyatwork/64603b9e7f169914f919f93b21673ae2 to your computer and use it in GitHub Desktop.
Save foleyatwork/64603b9e7f169914f919f93b21673ae2 to your computer and use it in GitHub Desktop.
// 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