Need help using global appModel/understanding data binding
See original GitHub issueHi - I am starting to learn preact/vdom/data-binding internals, and as an experiment looking to port automatic data-binding (like in vue.js
framework by the use of watchers) to preact
. It would be on the lines of generating a watch expression for all dependencies in a component and then subscribing to it by using Object proxies
whenever an attribute changes. The idea is to implement something like this:
A global object representing the state of various pieces:
var appModel = {
'user': { },
'tweets': [ ],
'notifications': [],
'followers': []
}
And, different components watching/binded over parts of the above model:
Preact.render(<ProfileBox user={ appModel.user } />, document.getElementById('profile'));
Preact.render(<TweetList list={ appModel.tweets } />, document.getElementById('tweetList'));
- What would be a good starting point to explore this?
- Are there ways already with
preact
to achieve something like above? - Are there any major challenges that are foreseen in developing an example as above.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Need help using global appModel/understanding data ...
Hi - I am starting to learn preact/vdom/data-binding internals, and as an experiment looking to port automatic data-binding (like in vue.js ...
Read more >Managing model data in your app
The binding connects the view element to the underlying model so that the user makes changes directly to the model data. See Also....
Read more >Retrieving and displaying data with model binding ...
This tutorial series demonstrates basic aspects of using model binding with an ASP.NET Web Forms project. Model binding makes data ...
Read more >Guide to app architecture - Android Developers
Data binding library. Overview · Get started · Layouts and binding expressions · Work with observable data objects · Generated binding ...
Read more >Chapter 4, Understanding and Using Angular Components
At its very simplest, a component is nothing but a class that encapsulates behavior (what data to load, what data to render, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you are looking for a single global object model for state change, then it’s exactly what Redux is doing: one single data store which is the sole source of truth. But I think the focus of what you want to achieve is notification through mutation, not to call
setState
repeatedly.Am closing this one now, as my queries have been answered. Thanks to everyone on the team.