5 ms·
This is why I'm so gung ho about Elm. To create a proper React single page app, you need React, Redux, lodash, react-router, webpack, Immutable.js, babel, npm,
by fbonetti 10y ago
This is why I'm so gung ho about Elm.
To create a proper React single page app, you need React, Redux, lodash, react-router, webpack, Immutable.js, babel, npm, redux-thunk, isomorphic-fetch, webpack-hot-middleware, and ton of boilerplate and configuration (which everyone does differently). You can try to assemble this yourself, or choose one of hundreds of starter projects on Github.
A comparable Elm app is a lot simpler. It consists of Elm, a router such as elm-transit-router, and maybe webpack if you want to watch and minify your compiled javascript. Especially now with the new 0.17, Elm forces you to use the standard Elm Architecture, so you don't waste any time thinking about how to structure your app and there's very little boilerplate as a result. On top of this, Elm is statically typed, functional, and simply a joy to work with.
- moogleii 10y agoI've no doubt Elm is simpler (considering it's more vertically integrated), but to be fair, if webpack is a maybe in Elm, lodash, immutable, isomorphic fetch, and webpack-hot-middleware would definitely be on my maybe list for React. Maybe maybes would include redux-thunk.
- callahad 10y agoVertical integration plays a part with blessed libraries for rendering, routing, and requests, but it's not just vertical integration: Elm completely obviates Immutable.js, TypeScript, Reselect, Redux-Thunk, and Lodash/Ramda by virtue of fundamental language design choices. The same goes for Haskell, OCaml, and PureScript. In that context, Redux becomes a design pattern, rather than a library. Ultimately, it feels like React's best practices and associated libraries try to bludgeon JavaScript into acting like a functional, immutable language. If that's the right model, I'd rather just use a language that was intentionally designed to be functional and immutable from the start. :)
- aidos 10y agoCan you embed an existing js app (angular) with Elm? Doesn't need to be any real communication between them. Just have the Elm app decide if the angular app is displayed or not. Honest question as I'm embedding angular in react at the moment and there's quite a lot of library fatigue going on.
- t1amat 10y agoYes, this is possible. Angular and Elm could easily communicate through Elm's JavaScript FFI.
- tracker1 10y agoI wouldn't put lodash or immutible-js right away, and may gear towards axios as a client communication library. The reason there's so much to do, is there are so many options... core parts of the tooling for modern js are fairly consistent... node is pretty much required, which brings npm.. understanding CJS and ES6 module syntax also required... a translator (babel|typescript|traceur) are pretty much required, as is a bundler (webpack|jspm+system|browserify). That'ss 1 x 3 x 3 potential configuration vectors without starting the application. Each has advantages and disadvantages... I'm webpack + babel myself. From there you have React, you need an orchestration layer, which has started to settle on Redux for all but the most complex applications. If you need async workflows, you're probably going to need redux-thunk and a communication library (fetch or axios). Beyond that, it depends on your needs specific to the application. If you need more than one route, then react-router and binding to redux. Everything beyond that depends on the specifics of your app and needs. There isn't a one size fits all.
- rickhanlonii 10y agoI can't recommend Immutable.js enough though, especially as your Redux state object.
- tracker1 10y agoI agree it's useful... however, it's far from a requirement if you're using React+Redux. Though there are some workflow changes if you are using Immutable.js with Redux. It's also the size (min+gz) of preact + redux combined. While still relatively small, depending on your needs it all adds up, and it really should depend on one's specific needs.