Add initial store implementation#65
Conversation
| FormDisplay, | ||
| } from 'react-dynamic-formbuilder'; | ||
|
|
||
| import FormBuilder from './FormBuilder'; |
There was a problem hiding this comment.
The consumer must create a Higher Order Component (HOC) from the original FormBuilder and pass in store reference. This means creating separate component file for their HOC
| export interface IStore { | ||
| // subscribe pushes the subscriber into a list and is called | ||
| // via notify() until unsubscribed. | ||
| subscribe(subscriber: ISubscriber): void; |
There was a problem hiding this comment.
ISubscriber is to not for a single change, all store changes will notify from this Subscriber. Right?
There was a problem hiding this comment.
Correct, every state change will notify all the observers.
| return new Store(props); | ||
| } | ||
|
|
||
| export interface IStore { |
There was a problem hiding this comment.
Probably, the name can always change to whatever we decide
| return new Store(props); | ||
| } | ||
|
|
||
| export interface IStore { |
There was a problem hiding this comment.
At beginning, I am considering only put editingContext inside in a bridge or even just a message channel between formbuilder and optionEditor.
There was a problem hiding this comment.
You could do that. From my opinion, it would be easier to develop/maintain a general store object that is responsible for handling all shared state between the react-dynamic-formbuilder components and distributing it to them much like Redux
This is an initial draft a store implementation.
goals: