-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature proposal: context properties #3508
Comments
Alternative syntax proposal with explicit
|
I agree. I had a similar proposal here (see "Per-Window" Specific State). It's basically the same except that your proposal makes the context implicit at the use site. FWIW, I really like your proposal. My main concern is what should happen if Such a context declaration could then also be imported/exported between |
That generally sounds like a good idea. In this case, the syntax with such system would be:
but i can see that there is a scoping issue as the One issue is that it gets more difficult to preview standalone component if they don't get these property. We already have the problem with default-font-familly and default-font-size on the window. |
One thing that we could do is to offer extra UI for users to change the contextual properties that are missing. In this example if previewing If we don't want to add support for default values to struct (which would be fair), then the first proposal would allow for that. |
Thinking ahead, something like the first syntax with properties, default values, bindings, and even functions instead of plain struct data would be much more powerful. There are many possibilities for the syntax. Here's yet another variant with an annotation. :)
|
It would be nice to have a way to propagate information to children without explicitly passing them as properties on each level aka. "property drilling".
This is conceptually similar to Context in React and InheritedWidget in Flutter. In Flutter, inherited widgets are used for implementing many core framework features including theming, localization, layout direction, navigation, and many external packages for dependency injection and state management.
The text was updated successfully, but these errors were encountered: