3 ms·
I'm just getting my feet wet with react - but my impression from various blog posts and a bit of coding - is that in the beginning there was reasonml (ocaml dia
by e12e 8y ago
I'm just getting my feet wet with react - but my impression from various blog posts and a bit of coding - is that in the beginning there was reasonml (ocaml dialect - mostly (but not only) targeting compilation to js target) - and react sort of "fell out" as a set of patterns/framework from doing functional programming of dom/gui/state.
And react for js, ("react") is those patterns + patterns for js to make everything (sort of) work without as solid a language to steer one away from various cliffs.
Which is one reason why I don't quite understand why there are class based components at all.
At any rate - my current goal is to try some reasonml+react - and I think it'll feel better. And I'm not surprised cs+react feels more sane than js+react.
- acemarke 8y agoReasonML is a very new language variant, and wasn't part of React's original implementation. There's a really good history at https://stackshare.io/posts/the-react-story https://stackshare.io/posts/the-react-story .
- e12e 8y agoThank you (and @scns). I had a hunch it was (an) ml > more programmers > new programmers unfamiliar with syntax > js version and reasonml. I didn't realize they didn't start with ocaml, but sml.
- e12e 8y agoIt's an interesting podcast, but wanders a bit, and there's no transcript. But does mention Jordan Walke who wrote the first prototype of react for Facebook ads. Jordan is currently working on reasonml: https://github.com/jordwalke https://github.com/jordwalke And Pete Hunt is: https://github.com/petehunt https://github.com/petehunt I should've remembered the bit about sml - it's mentioned here after all! : https://reasonml.github.io/docs/en/what-and-why.html https://reasonml.github.io/docs/en/what-and-why.html I do wonder if it'd be easier to port sml syntax to ocaml rather than make reasonml - I guess not. But it might give similar benefits: a pleasant syntax dialect for ocaml, a mature compiler for js and native, and bringing in th js and ocaml library ecosystems. [ed: but not, perhaps, 90% overlap with js syntax.] As I mentioned - I haven't really played with reasonml/reason-react - I think maybe some of the impressions alluded to in my first comment came in part from this: https://medium.com/@Imaginary_Cloud/reasonml-react-as-first-intended-68044fb6ba71 https://medium.com/@Imaginary_Cloud/reasonml-react-as-first-... In particular sentiments like: "When using ReasonML, we don’t need Redux anymore. ReactReason stateless components already come with the concept of a build in reducer, which is meant to take care of the problems Redux used to address." Discussed here: https://news.ycombinator.com/item?id=17143494 https://news.ycombinator.com/item?id=17143494 As well as the introduction here: https://github.com/reasonml-community/reductive/blob/master/README.md https://github.com/reasonml-community/reductive/blob/master/... "Reductive A reimplementation of redux in Reason. Word of Caution You might not need this library, especially so in a language which provides good enough construction blocks out of the box. ReasonReact already comes with reducers!" Also somewhat related (re: state) : https://reasonml.github.io/reason-react/docs/en/state-actions-reducer.html https://reasonml.github.io/reason-react/docs/en/state-action...
- larzang 8y ago> Which is one reason why I don't quite understand why there are class based components at all. Classes in js are just syntax sugar, so even if you're writing classes you're still actually writing function prototypes. As such there's little reason not to support them, and they're very welcome when you have a team of developers that are adapting to modern js development almost exclusively from traditional OO languages.
- e12e 8y agoHm. I might have to have another look at the implementation of classes in js. I still don't see the benefit of the syntax - but if it really amounts to just convoluted closures over variables, I guess I'll view them with a little less grumpiness :)
- scns 8y agoReact was first written in Standard ML