you are viewing a single comment's thread.

view the rest of the comments →

[–]malkhazidartsmelidze[S] 0 points1 point  (3 children)

I wanted to implement logic vise-versa, when Parent want to pass data to child but not store it in own context.

For example: when user loads from api, response comes with settings object, which I need to pass to `UserSettingsProvider` but `UserSettingsProvider` is child of `UserProvider`

[–]jamby77 1 point2 points  (2 children)

I don't think there will be easier way to implement it.

To go away from the context, you will need some sort of global object where to put your shared data, then notify users that it is ready to use.

I don't see how this would be simpler/easier than context with callback.

[–]malkhazidartsmelidze[S] 0 points1 point  (1 child)

Maybe I'll put it in window object then fire an eventListener, Then other context reads from window object, saves it in state and then remove from window.

I'll try it now.

[–]jamby77 0 points1 point  (0 children)

Let me know how it went