14

This is not a troll q, im gebuinely interested.

What sets spa frameworks (say react) apart from a templating engine and some dom fuckery? To me it seems they are all just syntactic sugar on top of these two very basic things (plus routing), but admittedly im not a frontend dev so im asking more experienced people here.

Comments
  • 2
    State management
  • 1
  • 9
    Mostly its pre packaged with all the boilerplate required for it to work well together.

    Using separate parts gives a bit more freedom with the expense that you have to know and do more your self.

    Also, as mentioned by @Codex404, react handles state changes and what needs to be redrawn along with optimizations so that you only redraw just that which are required.

    You could do that your self but it could easily increase your own code size 5-10 times with al the extra complexity.

    Its also quite difficult to do it in a way that works all through the application.

    In a commercial situation it will be hard to motivate the extra time. And the question is, will you actually do a better job, or is it just for pride ;)
  • 2
    React has virtual dom that actually makes ui mutations fast. Google “virtual dom”
  • 1
    @Voxera ion wanna make one, just interested whats the extra in the existing ones
  • 4
    State management is one thing, but more than anything I would say the way in which they work with an application that works mostly as a rest api. The cool thing about spas is that they are completely interchangeable from the backend, you don't rely on sessions and cookies which is something you have to do with template engine systems with their respective backend.

    They are also good for your pee pee
  • 0
    React has virtual dom which means it calculates the minimum changes needed to be done to the dom, plus it has cool jsx syntax and the state management
  • 0
    I'd say youre correct but if you think about it most people prefer to use a framework.

    If you're doing that already and want that highly dynamic dom manipulation then a spa is the next step in that thought process.

    These state management comments make sense - you can easily write a basic state management setup but it won't be as good as what spa framework provides so why bother fighting it
Add Comment