6

The combination of Lightning Component and React is NG? Is my understanding of this correct?

https://developer.salesforce.com/page/Requirements_Checklist

Use of third party MV * frameworks is not currently supported with Lightning. Any Lightning package that uses Angular or React or other third party DOM-based templating frameworks will automatically fail the security review until such time as we provide custom lightning components to properly encapsulate these frameworks. This is to avoid template injection attacks resulting from double interpolation. In order to use another framework as part of a package that uses Lightning, please use an iframe or Visualforce container until approved Lightning containers are published.

5

This is correct. Please use only one framework (Lightning). If you want to use React, you can do so in an iframe or in a VF page. If we do support React in the future, it would be with a custom component to properly separate it our from Lightning.

UPDATE: I'd like to point out that we may well support React and other frameworks in the future. In this case, please check the Requirements Checklist and our Secure Coding guidelines for lists of approved third party frameworks and secure usage instructions.

|improve this answer|||||
  • 2
    Now see some components are using D3.js and it is accessing SVG DOM with their own template engine. That is what the React is doing essentially. Any difference ? Capsulation is our matter, and we can safely do it by browserify or webpack. Not the platform's business. – stomita Dec 8 '15 at 7:43
  • 4
    Can you expand on the why of this rule? I don't understand the difference between React and any Javascript library that may be included like jQuery and D3? Is the concern that the developer is going to target the wrong div with their top level React.render (Couldn't the security review team validate that?) ? I don't see why this concern is limited to React and Angular, the bigger concern seems to be any js that mutates the dom? I think this deserves a little bit more clarification as we have been pitched from Day 1 of Lightning components that we can use whatever UI framework we want. – Mike Tetlow Dec 10 '15 at 17:27
  • 2
    Would it be acceptable to do my React.render in the lightning render lifecycle method as a replacement to the document.createElement in this tutorial: developer.salesforce.com/trailhead/project/… . I'd just be returning a complex node instead of a simple node. – Mike Tetlow Dec 10 '15 at 20:09
  • 4
    @RobertSussland The attempt of Lightning to control all of the timing of updating the DOM is so impractical - for example, jQuery sometimes asynchronously updates DOM attributes in their animation experiment. It seems a design flaw as a SPA framework if it is really intended. By restricting the update only for the DOM node which is not controlled by Lightning is much practical (this is what I'm doing currently, and safely working). – stomita Dec 11 '15 at 5:48
  • 2
    Still can't use react for lighting experience yet? – user3211 Jan 20 '16 at 0:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.