6 ms·
I've noticed the f(data) = view paradigm dominate the clojurescript landscape ever since om and reagent[1]. There's also a library that literally uses function
by escherize 11y ago
I've noticed the f(data) = view paradigm dominate the clojurescript landscape ever since om and reagent[1]. There's also a library that literally uses function calls and parameters for every piece of UI called re-frame[2] (which also has a badass readme).
Using pure functions to compose a UI along with keeping all the data in one place have been a huge win for our project for a few reasons.
1. All it takes to debug what a handler is doing is what effect it has on the DB. Our handler functions are also mostly pure functions which take the current-db as a parameter.
2. We can serialize the state to local storage (or a string) and reload it from local storage (or a string).
3. Using the repl, we can investigate the state of the application while it's running.
[1] http://reagent-project.github.io http://reagent-project.github.io
[2] https://github.com/Day8/re-frame/ https://github.com/Day8/re-frame/
- ds_scalar 11y agoYes! Re-Frame is fantastic, and a core part of a major project I am working on. In this spirit I am also really looking forward to Om Next.
- KurtMueller 11y agoI agree that re-frame is awesome. I also love reagent and figwheel. Are you planning to incorporate datascript or datomic at all in your projects?
- smrtinsert 11y agoIt is virtually impossible to go back to a non unidirectional ui without feeling gross and disgusted. Working on a major angular project after doing some cljs with react feels like a decades step back - back to a horrible jsf like two way data binding disaster. Where is my state? Where is my api? Why did x put y here? If it doesn't take hold this generation, it will definitely cycle back decades from now as the dominant way to structure ui code. Between unidirectional flows and observables (or maybe some other async primitive) UI is getting very interesting these days. Personally I prefer rx to core.async. Core async just looks too awkward and low-level for me. RX I got immediately - a promise for a stream. Great stuff.
- sehr 11y agoHave you messed with Cycle.js? They just hit 1.0 recently and use rx extensively, it's an absolute blast to use
- smrtinsert 11y agoIt's number one my list of projects to check out! Looking forward to it.
- KurtMueller 11y agoAre you using this in production? Or for a side project? How and where are you using it? Thanks for any info.
- sehr 11y agoJust on a couple of rinky dink side projects with babel & webpack! Nothing major
- jlu 11y agoand of course don't miss out cycle-react, which is based on rxjs and cycle.
- XorNot 11y agoClicked through to this, spent a bit of time going huh? But it very gradually started to come into focus. I definitely going to give it a whirl for a few small in house webapps - thanks!
- scotty79 11y ago> Working on a major angular project after doing some cljs with react feels like a decades step back It looked for me that way even before I started learning about React.
- hellofunk 11y agoAfter spending 3 years writing iOS interfaces solely in UIKit, my first work moving to cloud app development was solely in React/Om. It was like riding a bicycle for the first time. Amazing how far you could go in UI work with such (relatively) little effort.
- LiweiZ 11y agoDo you think it's a good idea to write React components with APIs somewhat mimic UIKit, such as UIView? Or is that possible? I'm new to web app. Thanks in advance.
- hellofunk 11y agoUIKit is a very OO framework. React is not. I'd recommend thinking about UI in a new way when moving to React.
- LiweiZ 11y agoThanks for your advice. One of the reasons that make me think this way is it seems there are some attempts to pick up inline CSS. IME, I believe object-based (or thing-based, it does not have to be strictly related to one paradigm) system is easier to understand when I work on UI. I'm probably biased and lack of enough knowledge and experience to see it through. This is just my current guess.
- RussianCow 11y agoOO is easier to grasp initially, but you have to keep track of lots of state, and that gets really hairy really quickly. The functional approach requires more forethought, but there's much less room for error because you aren't manually moving state around your application. It's a totally different way of thinking about UI, but it's worth it for the productivity you gain in the long run, in my opinion.
- LiweiZ 11y ago
- KurtMueller 11y agoI've been using re-frame for about a week now and it's awesome. Super simple to get into - building an interactive ui has never been so easy.
- MikeOfAu 11y agoWhile looking over a recently presented slidedeck, I came across this slide: https://speakerdeck.com/chantastic/inline-styles-react-europe?slide=9 https://speakerdeck.com/chantastic/inline-styles-react-europ... In that moment, I was genuinely taken aback to realise that by using clojurescript and reagent, I was operating in what some regarded as the future. I knew it already, of course, but that moment pushed it home. Nice! re-frame is pretty handy too. (But I'm the author, so on that point I'm pretty biased).