simple editor reacct

Solutions on MaxInterview for simple editor reacct by the best coders in the world

showing results for - "simple editor reacct"
Benoit
04 Feb 2017
1npm install react-simple-code-editor
Maria José
08 Sep 2017
1import React from "react";
2import Editor from "react-simple-code-editor";
3import { highlight, languages } from "prismjs/components/prism-core";
4import "prismjs/components/prism-clike";
5import "prismjs/components/prism-javascript";
6import "prismjs/themes/prism.css"; //Example style, you can use another
7
8function App() {
9  const [code, setCode] = React.useState(
10    `function add(a, b) {\n  return a + b;\n}`
11  );
12  return (
13    <Editor
14      value={code}
15      onValueChange={(code) => setCode(code)}
16      highlight={(code) => highlight(code, languages.js)}
17      padding={10}
18      style={{
19        fontFamily: '"Fira code", "Fira Mono", monospace',
20        fontSize: 12,
21      }}
22    />
23  );
24}
queries leading to this page
simple editor reacctsimple editor reacct