-
Notifications
You must be signed in to change notification settings - Fork 3
Description
suppose you have a top level component App
that maintains the app's data
, and a nested component Author
that receives information from the top level through its props. Then oninput
, it generates an event that notifies the top level component that it needs to change its data.
Currently the handler must know about the top level data structure, e.g. https://github.com/jspaaks/cff-initializer-javascript/blob/d5d53e9a362a250998baf10e0a197b159c92c937/src/AuthorHandler.js#L2-L7
which seems to violate the separation into components.
Would it makes sense to make the AuthorHandler
method part of the message payload? It would need to take an input argument authors
, and then the methods
in App
should just be a specification of which authors
the method from the message payload should be applied to.