4 ms·
Cycle is really cool, and I'd love to see reactive programming become more popular, but after trying it out for a project it has a few ergonomics issues that ke
by jakelazaroff 8y ago
Cycle is really cool, and I'd love to see reactive programming become more popular, but after trying it out for a project it has a few ergonomics issues that keep me from using it as my primary web framework.
- Dynamic lists of components are really annoying to create. In Cycle, the happy path is calling every component function in your app at startup to set up the data flow graph, and then your reactive operators handle the actual logic. With dynamically added or removed components, you get a stream of "sinks" and then have to splice them into your data flow somehow.
- Circular dependencies are cumbersome. If a parent passes a value to a child which can change that value in the parent, you essentially have to create a stub stream in the parent, use it to derive the parent's state and then "imitate" the output of the child as well.
That said, Cycle has a lot of great ideas that I want to become more mainstream. If you have a free weekend, try it! The creator André Staltz's blog is also a good read: https://staltz.com/ https://staltz.com/
- staltz 8y agoI totally agree with the two issues you listed! I think both of them are well enough addressed with Cycle State, a new state management library. It has an API makeCollection() specifically meant for dynamic lists, with good DX and great performance. Also I regret imitate(), and gladly using Cycle State I haven't found a single need anymore for imitate(). Not mentioned in the official docs (yet), but Cycle.js has nowadays full support for React DOM and React Native.
- staltz 8y agoSorry, forgot to link: https://github.com/cyclejs/react https://github.com/cyclejs/react https://github.com/cyclejs/react-dom https://github.com/cyclejs/react-dom https://github.com/cyclejs/react-native https://github.com/cyclejs/react-native
- aarpmcgee 8y agoIs there JSX support?
- jakelazaroff 8y agoYup! https://cycle.js.org/getting-started.html#getting-started-coding-consider-jsx https://cycle.js.org/getting-started.html#getting-started-co... If you're just starting out though (or even if you're not) I'd recommend checking out create-cycle-app, the Cycle analogue to create-cycle-app that will set up things like that for you: https://github.com/cyclejs-community/create-cycle-app https://github.com/cyclejs-community/create-cycle-app
- aarpmcgee 8y agoRad! Thanks!
- jakelazaroff 8y agoCycle State looks great! I had checked out onionify, but it didn't have anything like the makeCollection() API at that point. As an aside, thank you for all your work on Cycle! The project I was working on was a visual reactive programming and design tool, inspired by Bret Victor's on direct manipulation and abstraction and by your work on reactive programming and Cycle itself! I remember seeing something like that on the long-term Cycle roadmap as well, but I couldn't find it when writing that comment.