Variable: js-jsx-syntax

js-jsx-syntax is a customizable variable defined in js.el.gz.

Value

nil

Documentation

When non-nil, parse JavaScript with consideration for JSX syntax.

This enables proper font-locking and indentation of code using Facebook’s “JSX” syntax extension for JavaScript, for use with Facebook’s “React” library. Font-locking is like sgml-mode. Indentation is also like sgml-mode, although some indentation behavior may differ slightly to align more closely with the conventions of the React developer community.

When js-mode is already enabled, you should call js-jsx-enable to set this variable.

It is set to be buffer-local (and t) when in js-jsx-mode.

This variable was added, or its default value changed, in Emacs 27.1.

Probably introduced at or before Emacs version 27.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defcustom js-jsx-syntax nil
  "When non-nil, parse JavaScript with consideration for JSX syntax.

This enables proper font-locking and indentation of code using
Facebook’s “JSX” syntax extension for JavaScript, for use with
Facebook’s “React” library.  Font-locking is like `sgml-mode'.
Indentation is also like `sgml-mode', although some indentation
behavior may differ slightly to align more closely with the
conventions of the React developer community.

When `js-mode' is already enabled, you should call
`js-jsx-enable' to set this variable.

It is set to be buffer-local (and t) when in `js-jsx-mode'."
  :version "27.1"
  :type 'boolean
  :safe 'booleanp)