3 ms·
I've been using React for just about everything front-end wise for the past year. I don't think it's particularly hindered me, really. Sure, it was a learning c
by vegancap 10y ago
I've been using React for just about everything front-end wise for the past year. I don't think it's particularly hindered me, really. Sure, it was a learning curve, as was Redux, but now I understand those concepts better, my process is, I clone a 'react starter pack' from git, which has all of the build set-up I need, webpack, sass, ES6 etc, etc. And that's really it, I find it quicker to develop in React and Redux because the component approach, along with the immutability of Redux, allows me to overcome bugs pretty quickly. I find I run into less bugs, too, due to the predictability of doing everything the 'react/redux' way. I also find writing unit tests so easy in React, using 'dumb' components. So the result is, I've got some of the most bug-free, well tested front-end codebases I've ever worked on.
I guess everyone's experiences are different, and I understand that it's a difficult series of libraries to learn and understand fully, and that can be time consuming. But long-term I think it's a time saver.
- drdaeman 10y agoI'm quite surprised seeing quite many comments telling how they use React "for everything". Isn't React just a small[1] library that essentially does only one single thing? (And does it well) Takes a component definition, a state object, and then renders (and maintains) the component as a DOM structure? Unless I was looking into some other React that everyone's talking about, or I've had my eyes looking somewhere else and missed something giant - I'm sure it is. Then, how come everyone's doing everything with what's just an evolution of the templating libraries? I mean, even a simplest CRUD front-end webapp isn't only about the UI. Not trolling, I really don't get it. ____ [1] Well, technically it's not really small, because it does not of stuff under the hood to implement those virtual DOM and make things efficient. But it's end-user (=web developer who isn't hacking on React internals) functionality isn't wide-scoped. It's a library after all, not Angular or another we-do-it-all framework.
- corecoder 10y agoI'm not the parent, but I think that a lot of people (like me sometimes) say React as a short for React+Redux (or other flux implementations). Parent does mention redux, so I guess it applies to them also.
- drdaeman 10y agoYes, I suspect it, but there's also ton of other stuff besides UI component rendering and state transformations. I mean, stuff like persistence layer (communications with some sort of storage), data model and front-end form validation, etc. I don't think React or Redux provide those.
- vegancap 10y agoI think the great think about React, and stop me if I've missed your point, is that they're actually just libraries, not framework's, you can just pull in the parts you need and work off of those. Say you're just doing a single page application, with some basic logic. You can just use React on its own to create components, as you don't need an entire state life-cycle. We do this a lot to 'enhance' our statically generated sites. Or completely on the other end of the spectrum, you can use Redux, isomorphic rendering with Nodejs for example, react-router, and you can create a complete, dynamic site, with state, storage, authentication, whatever you need. Then you have everything in between. So you really can use React "for everything" in my view, and that's partly why I love it so much. I don't think React is just an "evolution of template libraries", I think React is a concept, I know React didn't invent this concept of 'components', far from it, but I think it brought about the most clear-cut, concise way of creating web components, largely thanks to React's use of JSX, I think. When you team that up with Webpack (which you totally should btw), you can house all of that components dependencies in the same directory, and call them within the component, a truly modular approach. (I promise you I don't secretly work for Facebook, I just love React).
- drdaeman 10y ago> they're actually just libraries, not framework's, you can just pull in the parts you need and work off of those Yes, that's the good part about it. Don't get me wrong, I'm very pleased with React for what it does. However, I only see it as a piece that does one certain thing (UI components), but still needs a lot of other pieces to make a whole. I've actually first used it exactly this way - to just animate what previously was a static server-processed <form>. Much less work, compared to what I'd have to do if I'd wanted to use some large framework (and bend to its way of doing all things). Still, I was quite confused, as React got marketed as a sort of panacea, and when I started to actually learn what it does, I found out it's essentially just an UI library and I need other pieces for my project. > I think React is a concept Aha! I see your point then. To me it's different. I see React just as glorified and fancy templating system evolution that can update the rendered object DOM in a smart way (rather than how it's with, e.g., Mustache where you have to discard the whole tree and place a new one over), properly preserving the DOM nodes and their internal states. It really looks like an evolution to me: - First, we had, e.g. Mustache (and myriad of others). They had one global template-wide state and rendered to a monolithic string without nodes. - Then came Backbone (and then Angular) that had layered states. A monolith broken to pieces. Not yet atoms, though. - Then came React and every node had its internal state, nicely propagated through the tree. To me it seems like a logical evolution. I'm not saying it's any trivial or an obvious step (it must've required a lot of effort to come with a nice implementation that React is), but not something ground-breaking either. Then there's Redux that does some FRP state transformations. But to me it's not React, as it doesn't even really depend on it (although very few use it otherwise, and even those who do probably do so only as proof-of-concept "hey, look, I can use it with [e.g.] Vue!"). Then there's, say, Immutable.js that does data structures that play nicely with FRP. Or, say, various communication libraries (ranging from jQuery.ajax and whatwg-fetch to Restful.js or Socket.IO). To me, such things are certainly not part of React. That's why I was surprised at "React" doing "everything". Guess, it's just a terminology issue then. Seems that many just call everything "React"...