Live JavaScript code evaluating
npm install react-livecode> Experimental
Live code evaluating:
- Evaluate every expressions your typed, no need to use console.log.
- Inspect result side by side.
- Support modules (using import).
```
npm install react-livecode
`js
import LiveCode from 'react-livecode'
import chunk from 'lodash/chunk'
render(
code={
2 ** 3
chunk(['a', 'b', 'c', 'd'], 2)
}`
/>
)
| Prop | Type | Default | Description |
| ----------- | --------- | -------------- | ----------------------------------------------------------------------------------------- |
| scope | Object | {} | Scope variables |code
| | string | '' | Code to evaluate |split
| | string | 'horizontal' | How to split editor and console, can be horizontal or vertical |autoFocus
| | boolean | false | Auto focus editor |modules
| | boolean | true | Enable using of modules |
Import Prism styles to your page:
`js`
import 'prismjs/themes/prism.css'
Or, load from external CDN:
`html``
rel="stylesheet"
href="https://unpkg.com/prismjs@1.15.0/themes/prism.css"
/>