MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / Form

Class Form

code/event-handlers/src/app.jsx:4–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import ReactDOM from 'react-dom';
3
4class Form extends React.Component {
5 constructor(props) {
6 super(props);
7 this._onNameChanged = this._onFieldChange.bind(this, 'name');
8 this._onPasswordChanged = this._onFieldChange.bind(this, 'password');
9 }
10 render() {
11 return (
12 <form>
13 <input onChange={ this._onNameChanged } />
14 <input onChange={ this._onPasswordChanged } />
15 </form>
16 );
17 }
18 _onFieldChange(field, event) {
19 console.log(`${ field } changed to ${ event.target.value }`);
20 }
21};
22
23class Switcher extends React.Component {
24 constructor(props) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected