3 ms·
Show HN: Starfx – A modern approach to side-effect and state management in UI
- qudat 3y agoHey all! I wanted to show-off something I've been working on for the better part of a year. At Aptible, we have been using starfx in production for a few months now with great success. Some resources to learn more: - Michigan TypeScript Talk: https://www.youtube.com/watch?si=Mok0J8Wp0Z-ahFrN&v=uRbqLGj_6mI&feature=youtu.be https://www.youtube.com/watch?si=Mok0J8Wp0Z-ahFrN&v=uRbqLGj_... - MVP: https://codesandbox.io/p/sandbox/starfx-simplest-dgqc9v?file=%2Fsrc%2Findex.tsx https://codesandbox.io/p/sandbox/starfx-simplest-dgqc9v?file... - Examples repo: https://github.com/neurosnap/starfx-examples https://github.com/neurosnap/starfx-examples - Production example: https://github.com/aptible/app-ui https://github.com/aptible/app-ui Happy to answer questions! Thanks for taking a look.
- dimitropoulos 3y agoyes but what do I say to my colleagues when they realize they need to learn generators (it's a non-trivial hurdle for many people)
- qudat 3y agoHi! Charles has a great article about why it's better to use generators over async/await: https://frontside.com/blog/2023-12-11-await-event-horizon/ https://frontside.com/blog/2023-12-11-await-event-horizon/ There are real benefits to using generators over async/await so I would encourage everyone to learn more about them and their benefits.
- cowboyd 3y ago> yes but what do I say to my colleagues when they realize they need to learn generators (it's a non-trivial hurdle for many people) Just tell them that they already know them. `yield*` is - a superset of `await` so if you understand `await`, you understand `yield*` - infinitely more powerful because it can handle any effect, not just Promise resolution. - It's just javascript syntax that predates `await`
- vladmargie 3y agoI'm glad I have the opportunity to reinforce the statements in this post. I can say without a doubt that starfx is an implementation that is as clean as it is powerful. At Softwiz, we have important production modules, which aggregate real business data of significant volume, written with starfx. I have followed the library's development since its inception, as it naturally follows from saga-query, providing a logical and seamless progression. Personally, I take great pleasure in writing code using "thunks," and I believe the technique challenges you to be more imaginative without being restrictive. For instance we can centralize the logic into thunks or apis, from different sources like IPC, workers, UI or the store itself. This allows us to combine or derive everything in an elegant manner. The familiarity comes, I think, from the database metaphor where we are used to work with tables views and queries and Starfx translates those concepts in JavaScript. From here roots a philosophy of handling effects, following the natural thought process for when we are managing data flows.