To begin with I would approach your question different way rather than
In what cases are lightning components the right choice? I would ask my self
In what cases are lightning components not the right choice?
Which Library Do You Need?
Third-party libraries usually fall in one of the following categories:
- DOM manipulation libraries (jQuery, etc)
- Specialized utility libraries (moment.js, numeral.js, etc)
- UI libraries (Bootstrap, jQuery UI, etc)
- Data visualization libraries (D3, Chart.js, Leaflet, etc)
- Component Based frameworks (React, Angular, etc)
Before we look at how you can use a third-party library in a Lightning Component, it’s useful to ask yourself why you are using it, and if you really need it. In some cases the answer will be a resounding yes: nobody wants to reinvent a data visualization library like D3 or a mapping library like Leaflet. In other cases the answer will be less clear. Let’s take a closer look at DOM manipulation libraries, UI libraries, and MVC frameworks in particular.
DOM Manipulation Libraries:
JavaScript has come a long way in recent years. Many DOM manipulation utilities we couldn’t live without in libraries like jQuery are now standard in the language. Modern frameworks like the Lightning Component Framework also provide abstractions that make jQuery less relevant
In the Lightning approach, the model and the view are decoupled: your code doesn’t have to reach into the DOM. This leads to more robust and more maintainable code. Avoiding direct DOM manipulation is a best practice in the Lightning Component Framework (like in most modern frameworks), and you might just discover that you no longer need your DOM manipulation library.
UI Libraries:
You may also want to reconsider the use of UI libraries like Bootstrap and jQuery UI. Although these libraries provide useful components, they have their own UI identity that can clash with the Lightning Experience identity. The Base Lightning Components and the Lightning Design System offer similar capabilities while providing a consistent user experience.
Component Based Frameworks:
At a high level, libraries like React and AngularJS have the same focus as the Lightning Component Framework: They provide code organization and utilities to create components. If you are looking for a component framework to develop applications on the Salesforce platform, you should use the Lightning Component Framework because it’s tightly integrated with the platform. But you can also use other frameworks if you so desire. All you have to do is choose the isolation mechanism (LockerService or Lightning Container Component) that works with your framework to avoid security exploits.
My Personal Experience:
I started with lightning back in 2016. Back then I get to mess around with jquery, kendojs(and couple of others too).
There are couple of reasons for using jQuery:
- Leveraging data tables
- Slicing and dicing the data and pushing it to the DOM
Kendo.js : Mainly for UI specific functionalities again like kendo grid, slider and many other one's.
Back then it made sense because lightning was new to broader community plagued by issues and bugs and bad documentation. I felt the need to depend on third party libraries and even slds was not what it was today. No well documented examples. Ahh it was a nightmare.
If I want to think about using the same-thing today I would rethink about it, because lightning as a framework matured a lot and keep getting better with every release I would want to make sure I truly need them.
And also with Locker service in picture it's hard to use libraries that doesn't adhere to its rules. Remember locker service is not the issue. It was built for a reason and that reason was security. Locker service also opened up and kept getting better for ex:usage of evals.
What made sense recently was using frameworks like D3 and chartjs or util libraries because you don't want to write everything from scratch that are not available in lightning. So in the end the idea is to look what you can do with lightning and look out for 3rd party libraries when you can't do the same things with lightning or it's not worth the time rebuilding it in lightning.
I might be right or I might be wrong but this is just out of my experience.
Update with Lightning Web components:(Spring 19)
Lightning Web Components is a new programming model for building Lightning components. It leverages the web standards breakthroughs of the last five years, can coexist and interoperate with the original Aura programming model, and delivers unparalleled performance.
If you are already developing Lightning components with the Aura
programming model, you can continue to do so. Your Aura components
will continue to work as before. You can build new components with
Aura or Lightning Web Components. Your Aura and Lightning Web
Components can coexist and interoperate. Over time, you can consider
migrating your Aura Components to Lightning Web Components, starting
with the components that would benefit the most from the performance
benefits of Lightning Web Components.
If you are new to developing on Lightning or if you are starting a new project, we recommend using the Lightning Web Components programming model.