DEV Community

Discussion on: Bad Habits of Mid-Level React Developers

Collapse
 
codewander profile image
codewander • Edited

Otherwise, (JS + tests) is better than TS for fast development and less overhead of maintaining a mountain of TS types that often leak bugs anyways.

I have been thinking this as well. I would only want to use rescript or elm, or just js. Of those three options, I am slightly leaning towards js with tests because I don't have to deal with any special tooling. If elm gains more momentum, or rescript launches a huge framework developed in rescript, I would make those my default. I am disappointed that Elm hasn't won (yet?). (I very rarely build small front ends, so my opinions here don't have a lot to back them up).

I have also been thinking about leaving business object data as json (e.g. package.elm-lang.org/packages/1602...) instead of converting to records, when using elm or rescript, because I think most business objects will eventually want some user defined fields.

Collapse
 
absynce profile image
Jared M. Smith

Elm is my go-to for a nice developer experience. For me it has "won".

I let my IDE (Atom/elmjutsu) generate decoders/encoders for me. You can use korban.net/elm/json2elm/ if your preferred editor doesn't support generating them. I don't recommend circumventing decoders.

I only decode/encode the data I need. Sometimes (usually) I want my model to look different that the data in the API, so I make tweaks for that. Decoding even helps me find flaws in my assumptions on data coming from the API too!

There's elm-graphql if that's an option for you.

Collapse
 
tbm206 profile image
Taha Ben Masaud

I recently started a JS project and had trouble with conflicting versions of npm dependencies. It took me a day to balance the correct versions and still couldn't use the latest version if one of the core dependencies. At some point, I was very tempted to switch to Elm because dependency management is easier. I just didn't want to handle encoding/decoding of JSON; lazy 😂

Thread Thread
 
codewander profile image
codewander

I would have just used an escape hatch like package.elm-lang.org/packages/1602...

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
 
tbm206 profile image
Taha Ben Masaud

💯😂