     (progn
       (evil-leader/set-key-for-mode 'react-mode  "m=" 'web-beautify-js))))
 
-(when (configuration-layer/layer-usedp 'auto-completion)
-  (defun react/post-init-company ()
-    (spacemacs|add-company-hook react-mode))
-
-  (defun react/init-company-tern ()
-    (use-package company-tern
-      :if (and (configuration-layer/package-usedp 'company)
-               (configuration-layer/package-usedp 'tern))
-      :defer t
-      :init
-      (push 'company-tern company-backends-react-mode))))
-
-;;
-;; Often the body of an initialize function uses `use-package'
-;; For more info on `use-package', see readme:
-;; https://github.com/jwiegley/use-package
+(defun react/post-init-web-mode ()
+  (define-derived-mode react-mode web-mode "react")
+  (add-to-list 'auto-mode-alist '("\\.jsx\\'" . react-mode))
+  (add-to-list 'auto-mode-alist '("\\.react.js\\'" . react-mode))
+  (add-to-list 'magic-mode-alist '("/** @jsx React.DOM */" . react-mode))
+  (add-hook 'react-mode-hook 'spacemacs//react-config-web-mode))

;;
;;; License: GPLv3

;; List of all packages to install and/or initialize. Built-in packages
;; which require an initialization must be listed explicitly in the list.
(setq react-packages
      '(
        web-mode
        js2-mode
        js2-refactor
        js-doc
        json-mode
        json-snatcher
        flycheck
        tern
        company
        company-tern
        web-beautify
        ))

;; List of packages to exclude.
(setq react-excluded-packages '())

;; For each package, define a function react/init-<package-name>
;;
(defun react/post-init-flycheck ()
  (add-hook 'react-mode-hook 'spacemacs//react-config-flycheck))

(defun react/post-init-web-mode ()
  (define-derived-mode react-mode web-mode "react")
  (add-to-list 'auto-mode-alist '("\\.jsx\\'" . react-mode))
  (add-to-list 'auto-mode-alist '("\\.react.js\\'" . react-mode))
  (add-to-list 'magic-mode-alist '("/** @jsx React.DOM */" . react-mode))

  (add-hook 'react-mode-hook 'spacemacs//react-config-web-mode))

(defun react/init-tern ()
  (use-package tern
    :defer t
    :config
    (progn
      (evil-leader/set-key-for-mode 'react-mode "mrrV" 'tern-rename-variable)
      (evil-leader/set-key-for-mode 'react-mode "mhd" 'tern-get-docs)
      (evil-leader/set-key-for-mode 'react-mode "mgg" 'tern-find-definition)
      (evil-leader/set-key-for-mode 'react-mode "mgG" 'tern-find-definition-by-name)
      (evil-leader/set-key-for-mode 'react-mode (kbd "m C-g") 'tern-pop-find-definition)
      (evil-leader/set-key-for-mode 'react-mode "mht" 'tern-get-type))))

(defun react/init-js2-mode ()
  (use-package js2-mode

      (evil-leader/set-key-for-mode 'react-mode (kbd "m C-g") 'tern-pop-find-definition)
      (evil-leader/set-key-for-mode 'react-mode "mht" 'tern-get-type))))

(defun react/init-web-beautify ()
  (use-package web-beautify
    :defer t
