A Simple and flexible playground for live editing React code.
npm install live-reacto!React live component !React live component !React live component
bash
$ npm install live-reacto
or via yarn
$ yarn add live-reacto
`Usage
`jsx
import { LiveProvider, LiveEditor, LivePreview } from 'live-reacto';// import your favorite prismjs theme
import "prismjs/themes/prism-dark.css";
const codeTest =
function App() {render(;
// External component
const Hello = () =>
code={codeTest}
readOnly={false}
onlyHighlight={false}
bindings={{ Hello }} //-> bind component
>
`
- LiveProvider
| Prop | Type | Description |
|--------------|--------------------------|-----------------------------------------------|
|language | string | Language to be hightlighted (default: jsx) |string
|code | | Some React code |Object
|bindings | | Add an external component or library. |Boolean
|onlyHighlight | | Disable LivePreview: works as Syntax highlighter.|Boolean
|readOnly | | Disable editing on the LiveEditor (Default: false).|
- LiveEditor
| Prop | Type | Description |
|----------|---------------|----------------------------------------------|
|onChange | method | returns live coding |Object
|style | | set css style for editor |
- LivePreview
| Prop | Type | Description |
|------------|--------------|--------------------------------------------|
|onTransform | method` | returns the code transpiled by Babel |