RE

React Refractor

react-refractor

Super-thin React wrapper for refractor (Syntax highlighting using VDOM)

Utilities
react
highlight
syntax
refractor
vdom
react-refractor
Utilities
javascript
npm
frontend
Stars
76
Weekly
782k
Open issues
6
Bundle
~25 kB

Installation

npm install react-refractor

Code example

import { useRefractor } from "react-refractor";

export function Example() {
  const value = useRefractor();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by Espen Hovlandsdal
  • 782k weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 6 open issues on GitHub

FAQs

Alternatives & similar libraries