Created
December 22, 2022 05:28
-
-
Save miguelmota/5eaad637551a9c918ea5771b399d36ff to your computer and use it in GitHub Desktop.
React syntax highligher code example component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' | |
import { tomorrow as theme } from 'react-syntax-highlighter/dist/esm/styles/prism' | |
export function SyntaxHighligher (props: { code: string }) { | |
const { code } = props | |
return ( | |
<SyntaxHighlighter | |
language="javascript" | |
style={theme} | |
showLineNumbers={true} | |
wrapLongLines={true} | |
> | |
{code} | |
</SyntaxHighlighter> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment