4 ms·
I migrated nearly all of troupeit.com over to ReactJS. I really love it, but my biggest complaint has to be the mixing of logic and views together, and the dup
by netik 11y ago
I migrated nearly all of troupeit.com over to ReactJS.
I really love it, but my biggest complaint has to be the mixing of logic and views together, and the duplication of security checks. Although I'm not entirely sure I can blame react for that, I blame my moving from CGI to Ajax/RESTFul interfaces for most of that pain.
We had about 90% of our codebase in RoR. In retrospect, I wish I had used Flux instead of React-Rails, but I didn't have that luxury as I was not starting from scratch.
As far as react and rendering data goes, I do wish there was an easier way in the render stack to conditionally display data. It's hard to squeeze logic into render()
- karmajunkie 11y agoI'm moving a project over to flux (well, reflux), and I'm still using react-rails. I'm probably doing a lot of stuff "wrong", but what I'm basically doing is instead of injecting data directly into the react component is inject it directly into the store.[1] Mainly I'm doing it as an intermediate step towards a separated client app with an api, but the upshot is (I think) my components are doing it in something that resembles a sane way, so all I need to modify later is the store logic. (Keeping in mind this is my first go-round with React, so those more experienced with it may tell both of us what a horrible idea this is. :) ) [1] https://gist.github.com/karmajunkie/8dd5367837ee8d2bd5bd https://gist.github.com/karmajunkie/8dd5367837ee8d2bd5bd
- nearengine 11y agoNot all of your logic has to be in render() itself. You can define other methods on your component that will be bound to `this` in render(), so you can just call them like `this.renderFoo()`. Each one just has to return a single root node with optional children like the render() method does.
- supercoder 11y agoI'm using ReactJS with a rails app, and are doing so without needing the security checks on the client side.