Last active
December 3, 2018 01:31
-
-
Save acro5piano/943483ed6785ac0595bdbdd441ba90fe to your computer and use it in GitHub Desktop.
jsx-no-lambda を recompose で回避 ref: https://qiita.com/acro5piano/items/7c90255a449295a43e59
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
// NG | |
const Component = ({ onChange }) => ( | |
<input onChange={e => onChange(e.target.value)} /> | |
) | |
export default Component |
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
// 回避できてない? | |
const Component = ({ onChange }) => { | |
const _onChange = e => onChange(e.target.value) | |
return <input onChange={_onChange} /> | |
} | |
export default Component |
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
import { withHandlers } from 'recompose' | |
const Component = ({ _onChange }: Props) => ( | |
<input onChange={_onChange} /> | |
) | |
export default withHandlers({ | |
_onChange: ({ onChange }) => e => onChange(e.target.value), | |
})(Component) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment