React-Ace provides a set of React components that wrap the Ace Editor, a high-performance code editor, allowing developers to easily embed sophisticated code editing capabilities into their React applications. The current stable version is 14.0.1, which includes support for React 19. The project demonstrates an active release cadence with frequent minor and patch updates, alongside periodic major version bumps to incorporate new features, bug fixes, and dependency upgrades, often aligning with updates to `ace-builds` itself. Key differentiators include its robust API for controlling editor behavior, support for various modes, themes, and extensions through the `ace-builds` package, and dedicated components for split view and diff editing, offering a comprehensive solution for interactive code snippets, IDE-like features, or rich text editing with syntax highlighting.
npm install react-aceVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates rendering a basic AceEditor component with JavaScript mode, GitHub theme, and essential extensions like language tools for autocompletion. It logs changes to the console and includes basic editor options for enhanced usability.
Remove `brace` from your dependencies. Install `ace-builds` (`npm install ace-builds`). Update all `import 'brace/mode/...'` statements to `import 'ace-builds/src-noconflict/mode/...'` and similar for themes and extensions. Refer to the 'Migrate to version 8' documentation.
Ensure you `npm install ace-builds` alongside `react-ace`. Import necessary modes (e.g., `import 'ace-builds/src-noconflict/mode-javascript';`) and themes (e.g., `import 'ace-builds/src-noconflict/theme-github';`) at the top level of your application or before your AceEditor component renders.
While often included in examples for compatibility, consider if `$blockScrolling: true` is truly necessary. For optimal performance and modern rendering, try to structure your CSS and components to avoid situations where `$blockScrolling` would be required. If you encounter issues, consult Ace Editor's documentation for alternatives.
Always review the `peerDependencies` in `package.json` for `react-ace` and ensure your `react` and `react-dom` versions satisfy these requirements. Similarly, check the `ace-builds` version used by `react-ace` in its `package.json` to ensure compatibility, or update `ace-builds` if necessary.
Ensure you have `ace-builds` installed and that the necessary `ace-builds` files are imported, particularly if you are trying to configure `ace.config.setOptions` or access other global Ace properties.
Make sure `import 'ace-builds';` or a specific mode/theme import that initializes the global `ace` object runs before any code attempting to access `ace.config` or similar properties.
For component-specific options, use the `setOptions` prop directly on the `AceEditor` component. For global Ace configurations, ensure `ace-builds` imports are at the top of your main entry file or explicitly manage their loading order.