You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in this discussion by @colin-grant-work we currently need a lot of props drilling to pass the relevant data to our components.
This issue/the amount of required prop drilling potentially increases with each new feature (e.g #70, #51).
As mentiond by @planger in the discussion we ideally would like to keep handling of messenger events in a central place on both ends (i.e. the App for the webview part). So we should look into a different approach of sharing central state (and update functions/hooks) with different components.
React provides the Context API for this.
The App component could be refactored into a context provider that exposes the MemoryAppState and update functions/hooks.
Nested components can then simply access the provided context via the context property.
Additional information
I have created a draft PR for this proposal: #85
The text was updated successfully, but these errors were encountered:
Description
As mentioned in this discussion by @colin-grant-work we currently need a lot of
props drilling
to pass the relevant data to our components.This issue/the amount of required prop drilling potentially increases with each new feature (e.g #70, #51).
As mentiond by @planger in the discussion we ideally would like to keep handling of messenger events in a central place on both ends (i.e. the App for the webview part). So we should look into a different approach of sharing central state (and update functions/hooks) with different components.
React provides the Context API for this.
The
App
component could be refactored into a context provider that exposes theMemoryAppState
and update functions/hooks.Nested components can then simply access the provided context via the
context
property.Additional information
I have created a draft PR for this proposal: #85
The text was updated successfully, but these errors were encountered: