guild_front/src/pages/CodeSnippetPage.js

21 lines
682 B
JavaScript
Raw Normal View History

2022-05-27 14:39:05 +03:00
import { useEffect, useState } from "react";
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
export const CodeSnippetlighter = () => {
const [codeString, setCodeString] = useState(``)
//
// useEffect(()=>{
// fetch('/code.txt')
// .then((r) => r.text())
// .then(text => {
// setCodeString(text)
// })
// }, [])
2022-05-27 14:39:05 +03:00
return (
<SyntaxHighlighter language={"javascript"} style={a11yDark} wrapLongLines={false} customStyle={{fontSize:14}} showLineNumbers={true}>
{codeString}
</SyntaxHighlighter>
);
};