== Why is this an issue? :noncompliant: javascript/noncompliant.adoc :compliant: javascript/compliant.adoc include::../description.adoc[] === Exceptions This rule does not apply in JSX expressions to support conditional rendering and conditional attributes as long as the nesting happens in separate JSX expression containers, i.e. JSX elements embedding JavaScript code, as shown below: [source,javascript] ---- return ( <> {isLoading ? ( ) : ( {isEditing ? 'Close now' : 'Start now'} !saving) : null} /> )} ); ---- If you have nested ternaries in the same JSX expression container, refactor your logic into a separate function like that: [source,javascript] ---- function myComponent(condition) { if (condition < 0) { return 'it is negative'; } else if (condition > 0) { return 'it is positive'; } else { return 'it is zero'; } } return ( {myComponent(foo)} ); ---- == Resources === Articles & blog posts * Sonar - https://www.sonarsource.com/blog/stop-nesting-ternaries-javascript/[Stop nesting ternaries in JavaScript] ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) include::../message.adoc[] include::../highlighting.adoc[] ''' == Comments And Links (visible only on this page) include::../comments-and-links.adoc[] endif::env-github,rspecator-view[]