[SalesForce] Lightning Framework vs Standard Client Side Frameworks (i.e. React) // Which to chose when, and why

Disclaimer

Keep it objective! This one can get a little opinionated, please try to keep your answer specific to the facts a developer should be considering when choosing between two viable options for architecting applications.

How to choose lighting framework vs other client side frameworks

These days we seem to have more choices than ever as Salesforce developers.

The Lightning/Aura Framework definitely is the gem of the Salesforce community and is a game changer from the view state hell of VisualForce.

On the other hand, there are a ton of amazing client side frameworks (React/Angular/Vue/Redux), that have a monstrous mind share in the broader web dev community and play quite nicely in hosted visualforce pages.

There are clear advantages and disadvantages to each approach. But what does the community think about this? In what cases are lightning components the right choice? And in what cases would another front-end framework make sense? What are the pros and cons of each approach?

Key areas to consider:

  • performance
  • learning curve
  • resource availability (React vs. Lightning Devs)
  • 3rd party support
  • security
  • project complexity
  • support resources (tutotorials, trainings, walkthroughs, api docs, example repos)

Best Answer

I haven't done much lightning development outside of a handful "hello world" apps, but I've been building React/Typescript/Visualforce apps on salesforce for several years and I'm confident that non-lightning/aura frameworks can work wonderfully with Salesforce.

It is possible to use most these frameworks INSIDE lightning containers, so I will speak mostly to developing a Visualforce SPA with something other than aura.

PROs of using React/Angular2/Vue with Visual Force

1: Get to enjoy a much larger ecosystem of packages, pre-built components, knowledge-base & community.

2: You get to use modern & robust development processes and tooling like Hot Module Reloading, type systems (typescript/flux), local debugging, application bundling, test frameworks, etc.

3: You can recruit developers from a much larger pool. The number of salesforce lightening developers is TINY in comparison to the number of react or angular devs. It also seems that the vast majority of them are junior (at least when it comes to javascript development).

4: You are free(ish) from the platform. If you write an application using aura, that application is never going to live anywhere else. If you write something with angular or react, it could more easily be migrated away from salesforce. If you wanted to keep the SF backend, it could be moved to heroku/aws with almost 0 effort.

*: Most the frameworks are just simply more performant, better designed, and more productive than aura. From what I've seen from aura so far (which isn't much), it's still not on the same playing field as react or angular2.

**: Even Salesforce sees the value of react. They are officially supporting the SLDS react component framework (even committed to an official web page). In the future, this question may actually be "Should I use React or Aura in my Lightening Component".

When you probably want to use lightning:

1: You're creating an encapsulated component (not SPA) that you want to live along side & communicate directly with other lightning components (you can still do this with react inside a lightning container). While VF pages can be embedded along side lightning components, it may not be as integrated/seamless.

2: You/your team doesn't have with any experience writing client side web applications. Modern web application has become much more complicated than it used to be. You need to understand dependency management, bundling, environments, etc. Architectural choices must be made on which framework, tooling, etc should be use. When developing on salesforce native tech's, you trade freedom, flexibility and capability for simplicity.

3: ??? I'm sure there are many other use-cases beyond the scope of my knowledge where platform restrictions might limit your ability to use these outside frameworks.

UPDATE

Even with the release of LWC I think most of the above still holds true. LWC are definitely an improvement over Aura (especially in performance), but IMO still way behind react/vue/angular in terms of productivity, scalability and community. LWC is still more of a framework for writing "widgets" than full blown SPA.

If you need uncompromised control over your application, the a VF page + React/Angular/Vue is the way to go.