34 ms·
My native web components fetch their own state. They pass data to children via attributes and to parents via event bubbling. Very happy with this solution. Re-r
by hellcow 4y ago
My native web components fetch their own state. They pass data to children via attributes and to parents via event bubbling. Very happy with this solution. Re-renders work using observableAttributes, which is part of the native component standard. It’s “just JavaScript” that everyone already understands and still avoids global state.
But while some of the UI I build is complex, I don’t build SPAs. If I did maybe this wouldn’t work as well.