Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created December 22, 2022 05:28
Show Gist options
  • Save miguelmota/5eaad637551a9c918ea5771b399d36ff to your computer and use it in GitHub Desktop.
Save miguelmota/5eaad637551a9c918ea5771b399d36ff to your computer and use it in GitHub Desktop.
React syntax highligher code example component
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