forked from Availity/availity-reactstrap-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobxForm.js
36 lines (30 loc) · 778 Bytes
/
MobxForm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { Component } from 'react';
import { extendObservable } from 'mobx';
import { observer } from 'mobx-react';
import { AvForm } from 'availity-reactstrap-validation';
import MobxFormComponent from './MobxFormComponent';
export class Pokemon {
constructor(json) {
const _json = json || {};
extendObservable(this, { name: _json.name || ''});
extendObservable(this, { rank: _json.rank || ''});
extendObservable(this, { type: _json.type || ''});
}
}
let pokemon;
class MobxForm extends Component {
constructor() {
super();
}
componentWillMount() {
pokemon = new Pokemon();
}
render() {
return (
<AvForm>
<MobxFormComponent pokemon={pokemon} />
</AvForm>
);
}
}
export default observer(MobxForm);