alexhisen / mobx-schema-form

MIT License
22 stars 6 forks source link

MobX state tree? #4

Open kristianmandrup opened 5 years ago

kristianmandrup commented 5 years ago

Would this work with MobX state tree? If not, I'd like to have a go at it...

alexhisen commented 5 years ago

I don't know that much about mobx-state-tree but I doubt it would work. mobx-schema-form is a wrapper around react-schema-form/lib/utils selectOrSet() which expects a plain object whose properties can be updated.

It might be possible to modify mobx-schema-form to check for 'getter' and 'setter' properties on data and dataErrors objects and, if present, invoke them instead of selectOrSet(). These functions would have to understand how to parse the nested object/array string syntax produced by https://www.npmjs.com/package/objectpath if you want them to work on non-flat data objects.