react-embed-code

Simple compoment to embed highlighted React code.

Usage no npm install needed!

<script type="module">
  import reactEmbedCode from 'https://cdn.skypack.dev/react-embed-code';
</script>

README

React Embed Code

Simple compoment to embed highlighted React code.

const str = `
import React, { Component } from 'react';

class Root extends Component {
   render() {
     return (
       <div>Root...</div>
     );
   }
 }
 
 export default Root;
`;

<Code embed={str} />

npm version

Install

npm install --save react-embed-code