a virtualized custom renderer for react syntax highlighter
npm install react-syntax-highlighter-virtualized-rendererReact Syntax Highlighter allows for the use of custom renderers to change the behavior of the way the syntax highlighted code is rendered. This module utilizes React Virtualized to virtualize rendering of non visible code nodes to allow for better performance when syntax highlighting large blocks. See an example: here
``shell`
npm install react-syntax-highlighter --save
npm install react-syntax-highlighter-virtualized-renderer --save
`js``
import SyntaxHighlighter from 'react-syntax-highlighter';
import virtualizedRenderer from 'react-syntax-highlighter-virtualized-renderer';
import { docco } from 'react-syntax-highlighter/dist/styles';
const Component = () => {
const codeString = '(num) => num + 1';
return (
style={docco}
renderer={virtualizedRenderer()}
>
{codeString}
);
}