What about passing props to react-formation forms to be used as initial values?
Since the schema is a static on the object you pass to CreateForm I mean..
I'm not sure what the best kind of api for this would be, but what I would want is something that enables me to do this in some sort of way (without any hacks):
Changes in CreateForm.js to make this work (hacky..):
config.mixins.push({
getInitialState: function getInitialState() {
var _this = this;
var state = {
didSubmit: false,
dirtyFields: {}
};
Object.keys(this.schema).forEach(function (key) {
state.dirtyFields[key] = false;
state[key] = _this.props.initial[key]; // new way to be able to use props as initial values
//state[key] = schema[key].initial; // old way
});
return state;
},
What are your thoughts about this..?
Should schema be a function getSchema instead, that enables you to use props?
What about passing props to react-formation forms to be used as initial values?
Since the schema is a static on the object you pass to
CreateForm
I mean..I'm not sure what the best kind of api for this would be, but what I would want is something that enables me to do this in some sort of way (without any hacks):
NoteForm
Component using NoteForm:
Changes in CreateForm.js to make this work (hacky..):
What are your thoughts about this..? Should
schema
be a functiongetSchema
instead, that enables you to use props?