Try this approach,

import "./styles.css";

import React, { Component } from "react";
import { makeStyles, createStyles } from "@material-ui/core/styles";
// import './CodeMirror.css';
import { Box, Button } from "@material-ui/core";
// Import Brace and the AceEditor Component
import AceEditor from "react-ace";
import TryItButton from "../CustomButton/TryItButton";
// Import a Mode (language)
import "ace-builds/src-noconflict/mode-javascript";
// Import a Theme (okadia, github, xcode etc)
import "ace-builds/src-noconflict/theme-twilight";

export default function App() {
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <CodeMirror />
      dsdsd
    </div>
  );
}

export interface AppProps {
  headings?: {
    key: number;
    name: string;
    pathname: string;
  }[];
  subheadings?: {
    key: number;
    name: string;
    calls: string[];
  }[];
}

interface AppState {
  value: string;
  textAreaValue?: string;
}

class CodeMirror extends Component<AppProps, AppState> {
  constructor(props: AppProps) {
    super(props);
    this.state = { value: "", textAreaValue: "" };
  }

  onChange(newValue: string) {
    console.log("CodeMirror value: ", newValue);
    this.setState({ value: newValue });
  }

  render() {
    return (
      <>
        <div className="main-container-codemirror">
          <div className="top-block-codemirror">
            <Box className="top-bar-text-codemirror">
              <i className="white">Example Call</i>
            </Box>
          </div>

          <div className="example-block-codemirror">
            <div className="textarea-example">
              <AceEditor
                // placeholder="Enter a call here..."
                mode="javascript"
                theme="twilight"
                name="ace-editor"
                fontSize={12}
                showPrintMargin
                wrapEnabled
                showGutter
                highlightActiveLine
                value={this.state.value}
                setOptions={{
                  enableBasicAutocompletion: true,
                  enableLiveAutocompletion: true,
                  enableSnippets: false,
                  showLineNumbers: true,
                  tabSize: 2,
                  useWorker: false
                }}
                style={{
                  // position: 'relative',
                  width: "100%",
                  height: "200px"
                }}
                onChange={(e) => this.onChange(e)}
              />
            </div>

            <div className="spacer">
              <Button
                className="try-it-button"
                onClick={() =>
                  this.setState((prev) => ({
                    ...prev,
                    textAreaValue: prev["value"]
                  }))
                }
                style={{
                  backgroundColor: "#533cf8",
                  color: "white",
                  borderRadius: 0,
                  fontSize: 13,
                  fontWeight: 200
                }}
              >
                Try it!
              </Button>
              <div className="spacer-text-div">
                auto-update 'fat', alphabetize payload, and make the example
                call below
              </div>
            </div>

            <div className="header-2">
              <i className="white">Example Response</i>
            </div>

            <div className="textarea-example">
              <textarea
                readOnly
                className="example-code"
                value={this.state.textAreaValue || "Response code"}
              />
            </div>

            <div className="bottom-block-codemirror" />
          </div>
        </div>
      </>
    );
  }
}

codeSandbox - https://codesandbox.io/s/reverent-microservice-yp2ff?file=/src/App.tsx:0-3764

Answer from Sarun UK on Stack Overflow
🌐
GitHub
github.com › securingsincity › react-ace › blob › main › types.d.ts
react-ace/types.d.ts at main · securingsincity/react-ace
// Type definitions for react-ace 4.1.3 · // Project: https://github.com/securingsincity/react-ace · // Definitions by: Alberto Nicoletti <https://github.com/illbexyz> · import { Component, CSSProperties } from "react"; · export interface Annotation { row: number; column: number; type: string; text: string; } ·
Author   securingsincity
🌐
npm
npmjs.com › package › react-ace
react-ace - npm
February 11, 2025 - NOTE FOR VERSION 8! : We have stopped support for Brace and now use Ace-builds. Please read the documentation on how to migrate. Examples are being updated. ... import React from "react"; import { render } from "react-dom"; import AceEditor from "react-ace"; import "ace-builds/src-noconflict/mode-java"; import "ace-builds/src-noconflict/theme-github"; import "ace-builds/src-noconflict/ext-language_tools"; function onChange(newValue) { console.log("change", newValue); } // Render editor render( <AceEditor mode="java" theme="github" onChange={onChange} name="UNIQUE_ID_OF_DIV" editorProps={{ $blockScrolling: true }} />, document.getElementById("example") );
      » npm install react-ace
    
Published   Feb 11, 2025
Version   14.0.1
Author   James Hrisho
Videos
00:30
🌐 YouTube
React Interview Prep: Ace Your Technical Questions! - YouTube
01:07
🌐 YouTube
Easy tip to Ace React Interviews - Folks don't use it enough - YouTube
🌐 tiktok.com
Big love to the small creators out there playing CODM on laggy phones, low graphics, and devices that overheat after 10 minutes. You’re not just playing the game you’re fighting through every frame drop, every crash, and still finding a way to create content. That’s different… bless❤️ You show up, you create, and you keep pushing even when no one’s watching That kind of passion can’t be bought, and trust me, your time will come…… Right now, I’m talking to some bigger creators, trying to figure out ways to get more eyes on you because you deserve it Nothing’s locked in yet, but I’m working on it. I’m doing this because I believe in you, and I know what it’s like to feel overlooked. We're building something real here. Keep going I’m with you… bless you all for the support, we can all grow and be big together ❤️ Check out @F.k🖤 for the last clip🔥 Every other clip credit to @GioVanni¿ @4G🌀 @ŠMØKË @Bankai is shadowbanned 🥹🤧 @Vexing @sys krm@lord @DEMA CODM 🥷🥷🥷 #codm #codmobile #acereact | TikTok
🌐 tiktok.com
TikTok - Make Your Day
🌐 tiktok.com
Best Codm clips I’ve seen this period 🔥 Credit to @K-RO 🥦👑 @TheYimbo @moeontt.amk @MR_PRAIZE_ @Infected codm @Clutch Joker 🃏 Underrated gamer: @F 𝐋𝐎𝐒𝐓 ␈ #codm #codmobile #acereact | TikTok
🌐 tiktok.com
Cindigo and Akman from temu😂😂 Checkout @AREMU ALAGIDI Credit to @𝐬𝐘𝐬 @Kimked @Pelumi❄️❤️‍🩹 #codm #codmobile #acereact | TikTok
🌐
GitHub
github.com › securingsincity › react-ace › blob › master › types.d.ts
react-ace/types.d.ts at master · securingsincity/react-ace
// Type definitions for react-ace 4.1.3 · // Project: https://github.com/securingsincity/react-ace · // Definitions by: Alberto Nicoletti <https://github.com/illbexyz> · import { Component, CSSProperties } from 'react' · export interface Annotation { row: number ·
Author   securingsincity
🌐
CodeSandbox
codesandbox.io › s › react-ace-editor-with-typing-dpqoe
React Ace Editor with typing - CodeSandbox
September 18, 2019 - React Ace Editor with typing by ksaaskil using babel, react, react-ace, react-dom, react-scripts
Published   Aug 26, 2019
Author   ksaaskil
Top answer
1 of 1
1

Try this approach,

import "./styles.css";

import React, { Component } from "react";
import { makeStyles, createStyles } from "@material-ui/core/styles";
// import './CodeMirror.css';
import { Box, Button } from "@material-ui/core";
// Import Brace and the AceEditor Component
import AceEditor from "react-ace";
import TryItButton from "../CustomButton/TryItButton";
// Import a Mode (language)
import "ace-builds/src-noconflict/mode-javascript";
// Import a Theme (okadia, github, xcode etc)
import "ace-builds/src-noconflict/theme-twilight";

export default function App() {
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <CodeMirror />
      dsdsd
    </div>
  );
}

export interface AppProps {
  headings?: {
    key: number;
    name: string;
    pathname: string;
  }[];
  subheadings?: {
    key: number;
    name: string;
    calls: string[];
  }[];
}

interface AppState {
  value: string;
  textAreaValue?: string;
}

class CodeMirror extends Component<AppProps, AppState> {
  constructor(props: AppProps) {
    super(props);
    this.state = { value: "", textAreaValue: "" };
  }

  onChange(newValue: string) {
    console.log("CodeMirror value: ", newValue);
    this.setState({ value: newValue });
  }

  render() {
    return (
      <>
        <div className="main-container-codemirror">
          <div className="top-block-codemirror">
            <Box className="top-bar-text-codemirror">
              <i className="white">Example Call</i>
            </Box>
          </div>

          <div className="example-block-codemirror">
            <div className="textarea-example">
              <AceEditor
                // placeholder="Enter a call here..."
                mode="javascript"
                theme="twilight"
                name="ace-editor"
                fontSize={12}
                showPrintMargin
                wrapEnabled
                showGutter
                highlightActiveLine
                value={this.state.value}
                setOptions={{
                  enableBasicAutocompletion: true,
                  enableLiveAutocompletion: true,
                  enableSnippets: false,
                  showLineNumbers: true,
                  tabSize: 2,
                  useWorker: false
                }}
                style={{
                  // position: 'relative',
                  width: "100%",
                  height: "200px"
                }}
                onChange={(e) => this.onChange(e)}
              />
            </div>

            <div className="spacer">
              <Button
                className="try-it-button"
                onClick={() =>
                  this.setState((prev) => ({
                    ...prev,
                    textAreaValue: prev["value"]
                  }))
                }
                style={{
                  backgroundColor: "#533cf8",
                  color: "white",
                  borderRadius: 0,
                  fontSize: 13,
                  fontWeight: 200
                }}
              >
                Try it!
              </Button>
              <div className="spacer-text-div">
                auto-update 'fat', alphabetize payload, and make the example
                call below
              </div>
            </div>

            <div className="header-2">
              <i className="white">Example Response</i>
            </div>

            <div className="textarea-example">
              <textarea
                readOnly
                className="example-code"
                value={this.state.textAreaValue || "Response code"}
              />
            </div>

            <div className="bottom-block-codemirror" />
          </div>
        </div>
      </>
    );
  }
}

codeSandbox - https://codesandbox.io/s/reverent-microservice-yp2ff?file=/src/App.tsx:0-3764

🌐
GitHub
github.com › securingsincity › react-ace
GitHub - securingsincity/react-ace: React Ace Component · GitHub
NOTE FOR VERSION 8! : We have stopped support for Brace and now use Ace-builds. Please read the documentation on how to migrate. Examples are being updated. ... import React from "react"; import { render } from "react-dom"; import AceEditor from "react-ace"; import "ace-builds/src-noconflict/mode-java"; import "ace-builds/src-noconflict/theme-github"; import "ace-builds/src-noconflict/ext-language_tools"; function onChange(newValue) { console.log("change", newValue); } // Render editor render( <AceEditor mode="java" theme="github" onChange={onChange} name="UNIQUE_ID_OF_DIV" editorProps={{ $blockScrolling: true }} />, document.getElementById("example") );
Starred by 4.2K users
Forked by 606 users
Languages   TypeScript 74.3% | JavaScript 23.6% | HTML 2.0% | CSS 0.1%
🌐
GitHub
github.com › securingsincity › react-ace › issues › 685
Cannot access editor using reference in Typescript · Issue #685 · securingsincity/react-ace
August 12, 2019 - render() { return ( <div className = "App" > <AceEditor ref = "aceEditor" Type error: Property 'editor' does not exist on type 'ReactInstance'. Property 'editor' does not exist on type 'Element'. TS2339 306 | 307 | componentDidMount() { > 308 | const editor = this.refs.aceEditor.editor; | ^ 309 |
Author   xhliu
Find elsewhere
🌐
StackBlitz
stackblitz.com › edit › react-ace-editor
React Ace Editor - StackBlitz
Starter project for React apps that exports to the create-react-app CLI.
🌐
GitHub
github.com › securingsincity › react-ace › blob › main › CHANGELOG.md
react-ace/CHANGELOG.md at main · securingsincity/react-ace
Use prop-type package instead of React.PropType · Fix ref related error · Reverse PureComponent use in AceEditor back to Component · Add ability to set scrollMargins · TypeScript Definitions
Author   securingsincity
🌐
GitHub
github.com › securingsincity › react-ace › releases
Releases · securingsincity/react-ace
1 person reacted · 25 Jun 01:25 · securingsincity · v12.0.0 · 24714c2 · Compare · Filter · Loading · There was an error while loading. Please reload this page. View all tags · v12.0.0 · Chore(deps-dev): Bump typescript from 5.4.3 to 5.5.2 by @dependabot in #1959 · Chore(deps-dev): Bump webpack from 5.91.0 to 5.92.1 by @dependabot in #1956 · Chore(deps): Bump ace-builds from 1.32.8 to 1.35.0 by @dependabot in #1946 ·
Author   securingsincity
🌐
npm
npmjs.com › package › react-ace-builds
react-ace-builds - npm
November 6, 2023 - A react component for Ace Editor. Latest version: 7.4.1, last published: 2 years ago. Start using react-ace-builds in your project by running `npm i react-ace-builds`. There are 3 other projects in the npm registry using react-ace-builds.
      » npm install react-ace-builds
    
Published   Nov 06, 2023
Version   7.4.1
Author   James Hrisho
🌐
Tessl
tessl.io › registry › tessl › npm-react-ace › 13.0.0
tessl/npm-react-ace@13.0.x - Registry - Tessl
September 15, 2025 - React-Ace is a comprehensive React component library that provides seamless integration with the Ace Editor (a high-performance code editor). It offers multiple editor components including the main AceEditor component, a Split Editor for ...
🌐
GitHub
github.com › securingsincity › react-ace › issues › 211
Typescript Supprt · Issue #211 · securingsincity/react-ace
May 28, 2017 - Problem The entire application should be written in typescript and output proper types update type definitions for Ace in Definitely Typed DefinitelyTyped/DefinitelyTyped#16788 update type definitions for Brace thlorenz/brace#89 and thlo...
Published   May 28, 2017
Author   securingsincity
🌐
Our Code World
ourcodeworld.com › articles › read › 562 › how-to-use-properly-ace-editor-in-reactjs
How to use properly ACE Editor in ReactJS | Our Code World
September 1, 2017 - The usage of Ace Editor in React is pretty simple, as everything has been abstracted into a single component namely <AceEditor>. This component expects almost all the properties of the original AceEditor but instead of passing them as an object, they're providen with props:
🌐
GitHub
github.com › securingsincity › react-ace › blob › master › docs › FAQ.md
react-ace/docs/FAQ.md at master · securingsincity/react-ace
import "ace-builds/src-noconflict/mode-java"; export class CustomHighlightRules extends window.ace.acequire( "ace/mode/text_highlight_rules" ).TextHighlightRules { constructor() { super(); this.$rules = { start: [ { token: "comment", regex: "#.*$" }, { token: "string", regex: '".*?"' } ] }; } } export default class CustomSqlMode extends window.ace.acequire("ace/mode/java") .Mode { constructor() { super(); this.HighlightRules = CustomHighlightRules; } } ... import React, { Component } from "react"; import AceEditor from "react-ace"; import CustomSqlMode from "./CustomSqlMode.js"; import "ace-bu
Author   securingsincity
🌐
DhiWise
dhiwise.com › post › a-guide-to-using-react-ace-for-efficient-coding
Unleashing the Power of React Ace: Tips and Tricks
February 21, 2024 - React Ace: Comparing FeaturesUsing it in Angular ApplicationsAdvanced Features: Autocompletion, Snippets, and Syntax CheckingPerformance Optimization Tips for React AceDebugging Common Issues in React Ace IntegrationExtending with Custom Components and PluginsContributing: Documentation, Backers, and SupportReal-World Examples: Checkout in ActionConclusion: Leveraging React Ace for Your Development Needs
🌐
npm
npmjs.com › package › @types › ace
@types/ace - npm
November 22, 2023 - TypeScript definitions for ace. Latest version: 0.0.52, last published: 2 years ago. Start using @types/ace in your project by running `npm i @types/ace`. There are 19 other projects in the npm registry using @types/ace.
      » npm install @types/ace
    
🌐
CodeSandbox
codesandbox.io › examples › package › react-ace
react-ace examples - CodeSandbox
AboutA react component for Ace Editor654,677Weekly Downloads · Latest version14.0.1 · LicenseMIT · External Links · github.com/securingsincity/react-ace#readme · github.com/securingsincity/react-ace/issues ·
🌐
CodePen
codepen.io › romseguy › pen › LGYxNj
React wrapper for Ace.js
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing. If active, Pens will autosave every 30 seconds after being saved once. If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update. If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting. ... Visit your global Editor Settings. ... class AceEditor extends React.Component { static propTypes = { mode: React.PropTypes.string, content: React.PropTypes.string, }; static defaultProps = { mode: 'javas