I see a lot of solutions in the Flutter ecosystem and none getting raves, so I decided to throw my "reactive first" Matrix[2] hat into the ring. Feedback welcome.
[0] https://github.com/mobxjs/mobx [1] https://github.com/ThoughtWorksInc/Binding.scala [2] https://github.com/kennytilton/mxtodomvc#readme
Vue works similar to React + MobX, but with weird design decisions like implicit reactivity, and a stale ecosystem thanks to the Vue2 vs Vue3 debacle.
Since Clojure is pervasively built on laziness, there has been some discussions in the community about doing the same but for incremental computation. And doing it pervasively most importantly guarantees it will work at any granularity without any manual fiddling with observables and reactions.
A recent contribution to the solution field in Clojure is micro_adapton [4][5] which looks like it is to incremental computing what miniKanren is to logic programming, i.e. a tiny core for a a challenging problem.
Also, considering the literature around it it seems to be pretty tricky to do properly, especially when it comes to databases [6].
[1] https://github.com/janestreet/incr_map [2] https://github.com/janestreet/incr_select [3] https://github.com/mobxjs/mobx [4] https://github.com/aibrahim/micro_adapton [5] https://arxiv.org/abs/1609.05337 [6] https://scholar.google.fr/scholar?hl=fr&as_sdt=0%2C5&q=incre...
https://github.com/facebook/flux
from facebook if you app has a lot of global state needs multiple stores can be handy.
Mobx is great too:
https://github.com/mobxjs/mobx
With the current project I am working on we actually just vanilla javascript with singeltons with subscriptions (note: I did not write this, but I think it is rxjs).
anyways someone should come along with some answers.
Redux is still the easiest and with Sagas is really cool. One start up I interviewed with was using something similar to hooks, but do not remember the name of it.
Also datomic (used by om.next in clojurescript) has some really clever optimizations and is a joy to use.
Yes, jQuery is still fine, just (maybe) dying a bit in popularity. The biggest problem I think most people had/have with jQuery is it doesn’t enforce any kind of structure, therefore leading to a ton of spaghetti code if the developer isn’t already fairly disciplined, unlike React/Vue that encourage (almost force) you to write highly modular code through components. However, I think a lot of this was caused by the fact that it was actually pretty hard to write modular JS in jQuery’s hay day, as things like ES6 modules didn’t exist.
> Is there a lightweight JS framework for UI?
Tons. Are they any good/well supported? Meh. I’m sure there are a few good ones out there, but none that have near the amount of dev support that React/Vue/Angular have. The only one I can think of that I’ve seen mentioned, in a positive manner, that might fall in this category and isn’t one of the ones normally thrown around is Riot.js[1], which may be interesting to you. It's mostly just regular JS, though it does have a template system, so depending on who you ask that's either really neat/good thing or the worst thing since ColdFusion.
> Should I implement my own state management lib
No.
> Redux
If you want to use Redux, you might as well add React. While you don’t technically have to use them together, I don’t know why you would use Redux without React (or at all). If you are interested in adding some sort of central state management, and aren’t interesting in adding a framework I’d suggest looking at MobX[2] instead. It’s quite a bit more agnostic than Redux.
> Have you ever been in this situation?
Yeah, about two(ish) years ago, I found myself working a fairly typical Rails app, and I wasn’t satisfied with how shitty the UI was, and wanted to add some JS crap to achieve the functionality I wanted (i.e more interactive & dynamic interface). I looked at React, tried some tutorials and all that, hated it almost immediately because of all the setup bullshit, weird api naming (which I believe has gotten better), and JSX looked like complete shit to me (still not in love with it).
So, I decided to check out this Vue thing that people were starting to talk about (was only an early version 1 then). First impressions were good, I didn’t have to configure a shit load of different build tools to add it to my monolithic Rails app, just added a js file (and you can still just do this), the docs were surprisingly easy to read and really helpful. I was productive with it after a few days, prior I had only done some very minimal jQuery crap. And what initially started out as an effort to add some interactivity turned into the entire frontend being rewritten in Vue because it’s (my opinion) that good.
jQuery is still fine, if you’re just looking to add some light interactivity, that’s literally what it’s good for. If you want to make a highly dynamic frontend, you’re probably best of biting the bullet and going for one of the major frameworks (React/Vue/Angular/Ember(?)), as they have the most support and aren’t going to be dropped because the maintainer realized he doesn’t give a shit anymore. And, I’d say Vue is likely the most approachable, as the docs are very good, the community is super helpful, and (if you want to) you can gradually ease into the full blown modern build config setup (vue-cli makes this something you don’t have to even worry about these days though). To start using Vue, you just have to link a js a file in your HTML like the good ol days (or even just use the CDN and not have to download anything)[3], unlike React/Angular which require build steps to be in place. I also think, in my slightly biased opinion, Vuex (Vue’s flux-esque state management lib) is the easiest to use, and it doesn’t try to be a general, framework agnostic, lib so it’s highly integrated into Vue which makes it easy add and unobtrusive to use — I add it to any Vue project I’m working on regardless of size because it’s so easy to work with. Not sure most people would be gunning to add Redux (boilerplate) to their projects until it actually needs it.
[2] https://github.com/mobxjs/mobx
[3] https://vuejs.org/v2/guide/installation.html#Direct-lt-scrip...
Initially I was wondering why we didn't have a centralised store, but once free from that mindset it allows you to keep observable data locally to where it's needed. Much nicer for encapsulation and separation of concerns.
Far less boilerplate too, as MobX does some very smart usage & dirty checking for you.
mobx-react also provides an @observer class annotation, which ends up working pretty magically - things re-render when they need to.
If anyone's interested, here are some tutorials from the author: https://egghead.io/courses/manage-complex-state-in-react-app...
Context API: https://reactjs.org/docs/context.html
Unstated: https://github.com/jamiebuilds/unstated
You learn what is evolving, and you grab onto it, and evolve right with it. This is easy territory for flame wars and "whatever fits you"/"there is no best stack", but that's not the full picture.
Your survival depends on what you know, life is full of surprises, death in family, cancers, car accidents, addiction, breakups, and depression.
Imagine a warrior, ask him, "what is the best weapon?" and can you really imagine him saying "There is no best weapon", no, s/he would never say that.
You go on the most popular code hosting website, you sort by number of stars and begin at the top.
To give you a specific answer "iOS, Android and a Web App" in context of "Inventory Management - Dealer Management - Accounting - Payroll - Analytics" is Apache Cordova, (iOS, Android, and others), you use npm/node this way you will have one code base, you won't have to write the same code in multiple languages (just imagine scaling a live data sync requirement in one app and then standard REST in another -- keep it all in one language, or you will fail.)
"Inventory Management - Dealer Management - Accounting - Payroll" is all pretty simple (but, please explore ideas like http://vorpal.js.org/ just to develop your API before getting to G-UI, finish your programs in the terminal first.
Don't pretend programs are written GUI first, they are not. GUI is a leaky abstraction to say the least.) Don't fall for redux, relax and use https://github.com/mobxjs/mobx for actual GUI, (by the time you get to this part https://vuejs.org/ will rule)
And for your Analytics front-end D3, it is a departure from standard JavaScript but it has a lot of love inside.
Finally, remember develop commands/API first, get your apps working in the CLI and you will finish your program before starting it. Think about using the power of Unix (https://www.npmjs.com/package/commander), for the love of all that is mighty think about IRC, NOBODY! has time to learn to use your apps/GUI and NOBODY! ever needed to learn how to use Siri, so create a Command Line Interface version of your program and before you jump to React/Vue meditate over https://hubot.github.com/ and programs like Siri.
Finally, if I was facing your requirements, I would build a wiki/forum where your users would interact with bots. Over time I'd rip put some of the robotic guts and boldly go where humanity needs to be headed, I'd replace them with what I call Artificial-Artificial Intelligence, networks of Human Mechanical Turks where anybody could participate.
Neural networks are easy to train, but they are also easy to trick. Nothing will beat a random sample of Humans from across the world reaching a consensus on a tough decision.
In closing, People, Real Hearts, Human Minds, powering your network would share in your profits, and you'd do your part in battling what ails us all, World's Poverty.
If a mother in Rwanda and a Boy in India participating in your Mechanical Turk can find their way out of poverty, by helping your to detect fraud in your circuit. Then, you did your part, to help Humanity grow.
https://github.com/mobxjs/mobx
It says "simple" but looks complicated. Any pointers? Is it because I don't know how decorators work it looks complicated?
Then also I would recommend MobX [1] over Redux, it's easier to get started and in my opinion easier and better in general.
[0] https://medium.com/@dan_abramov/you-might-not-need-redux-be4...
Quite the opposite. Relay allows you to write proper presentation components and then wrap them in data-provider components. This is a step toward isolation of presentation and data management. If you could move all methods that actually manipulate the data up out of the presentation components and into their wrappers, that's even better.
Unfortunately, the parent component has to reference the wrapper instead of the wrapped component, so you get this alternation between presentation and data management. But at least the leaf nodes can be considered reusable presentation components with no coupling to the data layer.
Anyway, everyone is doing this these days. Check out:
I haven't used any of those but would like to know about them before I start using any of those.
I'm curious how that ends up working out. It is intriguing and enticing to me, because I have had similar experiences that the most 'challenging' part of using react is the flux part not the actual react part. But I'm just a react newbie, and based on my experience so far, am scared to go 'off the common path' at all because it tends to end up being a royal mess for reasons I didn't have the experience to predict in advance. :)