Remove menial event handling
npm install react-action-decorators
# or
yarn add react-action-decorators
import React from 'react';
import { withTemplateHelpers } from 'react-action-decorators';
@withTemplateHelpers
export default class MyComponent extends Component {
render() {
const { mut } = this;
const { text } = this.state;
return (
<div>
<input value={text} onChange={mut('text')} />
</div>
);
}
}
Demo: https://codesandbox.io/s/2067py0prn
mut
toggle
pipe