README
JS Live
A React Component for live rendering and editing of HTML, CSS and JS.
Usage
npm install react-js-live
import React from "react";
import JSLive from "react-js-live";
import "react-js-live/build/main.css";
function App() {
return <JSLive id="test" snippets={snippets} mode="js" />;
}
Props:
id
A string that uniquely identifies the frame on the page.
- snippets
Object containing keys: html
, css
and js
. This is the initial code passed into the component.
const snippets = {
html: `<p>HTML Content goes here</p>`,
css: `.title { color: red; }`,
js: `alert(js)`
};
mode
default:
js
html
: Left tab defaults to HTML and Right defaults to Resultjs
Left tab defaults to JS and Right tab to Console.
theme
default: Night Owl
Any PrismJS theme.
Contributing
- Clone the repo
npm install
npm start