Are mode and theme imports required for react-ace?

91 views Asked by At

I am using react-ace for my project.

According to the document, if I want to use mode and theme, two import statements are needed.

import "ace-builds/src-noconflict/mode-java";
import 'ace-builds/src-noconflict/theme-github';

 <AceEditor
    mode="java"
    theme="github"
    onChange={onChange}
    name="UNIQUE_ID_OF_DIV"
    editorProps={{ $blockScrolling: true }}
  />,

However, seems like the mode and the theme of editor can be set only passing props to the AceEditor component without declaring those import statements.

Can any issue be introduced if I omit those statments?

1

There are 1 answers

0
user1813302 On

If you try to omit the import statements the ace-editor will try to fetch them dynamically from your local host and you will get console errors.

You must also include 'ace-builds/src-noconflict/ace', otherwise specific functionalities (like markers) won't work and you will see exceptions from ace.js library file.