drom / resch

:herb: React JSON Schema Form
https://beta.observablehq.com/@drom/resch-reactive-schema
MIT License
9 stars 2 forks source link

propogation of custom config from top to children #47

Open danziamo opened 6 years ago

danziamo commented 6 years ago

right now config looks following way

this.Form = genForm({
    schema: rockSchema,
    path: [],
    updateState: this.updateState,
});

It would be nice if resch could propogate down some custom config objects down (so there would be no necessity in creating custom widgets)

this.Form = genForm({
    schema: rockSchema,
    path: [],
    fn: {
        updateState: this.updateState,
        myCustomFunction: this.firstFn,
        anotherFn: this.secondFn
});
danziamo commented 6 years ago

If i want to host two resch applications using only one state. Is it possible to make such all data from 1st application would be stored under data, and all data from 2nd applications would be stored under other name, for example parameters. So it would be

this.state = {
  data: undefined, // all data belonging to 1st resch
  parameters: undefined // all data belonging to 2nd resch
}

Cause right now i might have to duplicate default widgets

drom commented 6 years ago

@danziamo what if you keep data over one more layer? like state.app1.data and state.app2.data ?

danziamo commented 6 years ago

@drom good idea. Will do this. It means. I just need to create another updateState function